Examples of IQueryContext


Examples of net.sf.logsaw.index.IQueryContext

    try {
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_LOGGER, Operators.OPERATOR_BEGINS_WITH,
            "com.arjuna.ats.jbossatx.jta"));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(4, p.getItems().size());
        assertEquals(4, p.getTotalHits());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here

Examples of net.sf.logsaw.index.IQueryContext

    try {
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_LOGGER, Operators.OPERATOR_NOT_BEGINS_WITH,
            "com.arjuna.ats.jbossatx.jta"));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(1, p.getItems().size());
        assertEquals(1, p.getTotalHits());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here

Examples of net.sf.logsaw.index.IQueryContext

    try {
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_TIMESTAMP,
            Operators.OPERATOR_BEFORE, new Date(1248183795937L)));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(1, p.getItems().size());
        assertEquals(1, p.getTotalHits());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here

Examples of net.sf.logsaw.index.IQueryContext

    try {
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_TIMESTAMP,
            Operators.OPERATOR_AFTER, new Date(1248183796156L)));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(1, p.getItems().size());
        assertEquals(1, p.getTotalHits());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here

Examples of net.sf.logsaw.index.IQueryContext

    try {
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_LEVEL, Operators.OPERATOR_LESS_THAN,
            Log4JFieldProvider.FIELD_LEVEL.getLevelProvider().findLevel("warn")));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(4, p.getItems().size());
        assertEquals(4, p.getTotalHits());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here

Examples of net.sf.logsaw.index.IQueryContext

    try {
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_LEVEL, Operators.OPERATOR_GREATER_THAN,
            Log4JFieldProvider.FIELD_LEVEL.getLevelProvider().findLevel("info")));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(1, p.getItems().size());
        assertEquals(1, p.getTotalHits());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here

Examples of net.sf.logsaw.index.IQueryContext

    try {
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_LEVEL, Operators.OPERATOR_EQUALS,
            Log4JFieldProvider.FIELD_LEVEL.getLevelProvider().findLevel("warn")));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(1, p.getItems().size());
        assertEquals(1, p.getTotalHits());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here

Examples of net.sf.logsaw.index.IQueryContext

    try {
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_LEVEL, Operators.OPERATOR_NOT_EQUALS,
            Log4JFieldProvider.FIELD_LEVEL.getLevelProvider().findLevel("info")));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(1, p.getItems().size());
        assertEquals(1, p.getTotalHits());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here

Examples of net.sf.logsaw.index.IQueryContext

    try {
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_TIMESTAMP,
            Operators.OPERATOR_AFTER, new Date(1248183795312L)));
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_TIMESTAMP,
            Operators.OPERATOR_BEFORE, new Date(1248183796234L)));
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_MESSAGE,
            Operators.OPERATOR_CONTAINS, "manager"));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(2, p.getItems().size());
        assertEquals(2, p.getTotalHits());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here

Examples of net.sf.logsaw.index.IQueryContext

    try {
      IIndexService indexService = IndexPlugin.getDefault().getIndexService();
      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_MESSAGE,
            Operators.OPERATOR_CONTAINS, "Recovery"));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(2, p.getItems().size());
        assertEquals(2, p.getTotalHits());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
      getLogger().error(e.getLocalizedMessage(), e);
      fail("Exception should not occur: " + e.getLocalizedMessage());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.