Package co.nubetech.crux.model

Examples of co.nubetech.crux.model.Report


   
    KeyValue kv = new KeyValue(row, family, q, value);
    List<KeyValue> kvList = new ArrayList<KeyValue>();
    kvList.add(kv);
   
    Report report = new Report();
    Mapping mapping = new Mapping();
    mapping.setTableName("TABLE_2");

    RowAlias rAlias1 = new RowAlias();
    rAlias1.setAlias("rowkeyLong");
View Full Code Here


  }

  @Test
  public void testIsGetOperationWithColFilters() throws CruxException {
    Report report = new Report();
    Mapping mapping = new Mapping();

    FilterType filter1 = new FilterType();
    filter1.setType("Equals");

    RowAlias rAlias = new RowAlias();
    rAlias.setAlias("rowkey");
    rAlias.setLength(8);
    mapping.addRowAlias(rAlias);

    ColumnAlias cAlias = new ColumnAlias();
    cAlias.setAlias("col");
    mapping.addColumnAlias(cAlias);

    ColumnFilter colFilter = new ColumnFilter();
    FilterType filterType = new FilterType();
    filterType.setType("Not Equals");

    colFilter.setFilterType(filterType);
    colFilter.setColumnAlias(cAlias);

    RowAliasFilter rowFilter = new RowAliasFilter();
    rowFilter.setFilterType(filter1);
    rowFilter.setRowAlias(rAlias);

    ArrayList<RowAliasFilter> filters = new ArrayList<RowAliasFilter>();
    filters.add(rowFilter);

    ArrayList<ColumnFilter> colFilters = new ArrayList<ColumnFilter>();
    colFilters.add(colFilter);

    report.setRowAliasFilters(filters);
    report.setColumnFilters(colFilters);

    QueryExecutor exec = new QueryExecutor(null);
    assertTrue(exec.isGetOperation(report, mapping));

  }
View Full Code Here

  }

  @Test
  public void testNotIsGetOperationWithColFilters() throws CruxException {
    Report report = new Report();
    Mapping mapping = new Mapping();

    FilterType filter1 = new FilterType();
    filter1.setType("Not Equals");

    RowAlias rAlias = new RowAlias();
    rAlias.setAlias("rowkey");
    rAlias.setLength(8);
    mapping.addRowAlias(rAlias);

    ColumnAlias cAlias = new ColumnAlias();
    cAlias.setAlias("col");
    mapping.addColumnAlias(cAlias);

    ColumnFilter colFilter = new ColumnFilter();
    FilterType filterType = new FilterType();
    filterType.setType("Equals");

    colFilter.setFilterType(filterType);
    colFilter.setColumnAlias(cAlias);

    RowAliasFilter rowFilter = new RowAliasFilter();
    rowFilter.setFilterType(filter1);
    rowFilter.setRowAlias(rAlias);

    ArrayList<RowAliasFilter> filters = new ArrayList<RowAliasFilter>();
    filters.add(rowFilter);

    ArrayList<ColumnFilter> colFilters = new ArrayList<ColumnFilter>();
    colFilters.add(colFilter);

    report.setRowAliasFilters(filters);
    report.setColumnFilters(colFilters);

    QueryExecutor exec = new QueryExecutor(null);
    assertTrue(!exec.isGetOperation(report, mapping));
  }
View Full Code Here

    assertTrue(!exec.isGetOperation(report, mapping));
  }

  @Test
  public void testIsGetOperationMultipleRowAliases() throws CruxException {
    Report report = new Report();
    Mapping mapping = new Mapping();
    ColumnAlias cAlias = new ColumnAlias();
    cAlias.setAlias("col");
    mapping.addColumnAlias(cAlias);

    ColumnFilter colFilter = new ColumnFilter();
    FilterType filterType = new FilterType();
    filterType.setType("Not Equals");
    colFilter.setFilterType(filterType);
    colFilter.setColumnAlias(cAlias);
    ArrayList<ColumnFilter> colFilters = new ArrayList<ColumnFilter>();
    colFilters.add(colFilter);

    ArrayList<RowAliasFilter> filters = new ArrayList<RowAliasFilter>();

    for (int i = 0; i < 5; ++i) {

      FilterType filter1 = new FilterType();
      filter1.setType("Equals");
      RowAlias rAlias = new RowAlias();
      rAlias.setAlias("rowkey" + i);
      mapping.addRowAlias(rAlias);

      RowAliasFilter rowFilter = new RowAliasFilter();
      rowFilter.setFilterType(filter1);
      rowFilter.setRowAlias(rAlias);

      filters.add(rowFilter);
    }
    report.setRowAliasFilters(filters);
    report.setColumnFilters(colFilters);

    QueryExecutor exec = new QueryExecutor(null);
    assertTrue(exec.isGetOperation(report, mapping));

  }
View Full Code Here

  }

  @Test
  public void testIsGetOperationMultipleRowAliasesSomeNotEquals()
      throws CruxException {
    Report report = new Report();
    Mapping mapping = new Mapping();
    ColumnAlias cAlias = new ColumnAlias();
    cAlias.setAlias("col");
    mapping.addColumnAlias(cAlias);

    ColumnFilter colFilter = new ColumnFilter();
    FilterType filterType = new FilterType();
    filterType.setType("Not Equals");
    colFilter.setFilterType(filterType);
    colFilter.setColumnAlias(cAlias);
    ArrayList<ColumnFilter> colFilters = new ArrayList<ColumnFilter>();
    colFilters.add(colFilter);

    ArrayList<RowAliasFilter> filters = new ArrayList<RowAliasFilter>();

    for (int i = 0; i < 5; ++i) {

      FilterType filter1 = new FilterType();
      String rowFilterType = "Equals";
      if (i % 2 == 0) {
        rowFilterType = "Less Than";
      }
      filter1.setType(rowFilterType);
      RowAlias rAlias = new RowAlias();
      rAlias.setAlias("rowkey" + i);
      mapping.addRowAlias(rAlias);

      RowAliasFilter rowFilter = new RowAliasFilter();
      rowFilter.setFilterType(filter1);
      rowFilter.setRowAlias(rAlias);

      filters.add(rowFilter);
    }
    report.setRowAliasFilters(filters);
    report.setColumnFilters(colFilters);

    QueryExecutor exec = new QueryExecutor(null);
    assertTrue(!exec.isGetOperation(report, mapping));
  }
View Full Code Here

    assertTrue(!exec.isGetOperation(report, mapping));
  }

  @Test
  public void testGetRowForRowFilterinDifferentOrder() throws CruxException {
    Report report = new Report();
    Mapping mapping = new Mapping();

    ValueType longType = new ValueType(1l, new Datastore(), "Long",
        "java.lang.Long", true);
    ValueType stringType = new ValueType(1l, new Datastore(), "String",
        "java.lang.String", false);

    RowAlias rAliasLong = new RowAlias();
    rAliasLong.setAlias("rowkey");
    rAliasLong.setId(1);
    rAliasLong.setLength(8);
    rAliasLong.setMapping(mapping);
    rAliasLong.setValueType(longType);

    RowAlias rAliasString = new RowAlias();
    rAliasString.setAlias("rowkey");
    rAliasString.setId(2);
    rAliasString.setLength(4);
    rAliasString.setMapping(mapping);
    rAliasString.setValueType(stringType);

    mapping.addRowAlias(rAliasLong);
    mapping.addRowAlias(rAliasString);

    FilterType filter1 = new FilterType();
    filter1.setType("Equals");

    RowAliasFilter rowFilter1 = new RowAliasFilter();
    rowFilter1.setId(1);
    rowFilter1.setFilterType(filter1);
    rowFilter1.setRowAlias(rAliasString);
    rowFilter1.setValue("String");

    RowAliasFilter rowFilter2 = new RowAliasFilter();
    rowFilter2.setId(2);
    rowFilter2.setFilterType(filter1);
    rowFilter2.setRowAlias(rAliasLong);
    rowFilter2.setValue("123");

    ArrayList<RowAliasFilter> filters = new ArrayList<RowAliasFilter>();
    filters.add(rowFilter1);
    filters.add(rowFilter2);

    report.setRowAliasFilters(filters);
    byte[] row = QueryExecutor.getGetRow(report, mapping);
    byte[] expected = Bytes.add(Bytes.toBytes(123l),
        Bytes.toBytes("String"));

    assertTrue(Bytes.equals(expected, row));
View Full Code Here

    rowAlias.setAlias("alias");
   
    RowAliasFilter rowFilter = new RowAliasFilter();
    rowFilter.setId(1);
    rowFilter.setFilterType(new FilterType(1, "Greater Than Equals"));
    rowFilter.setReport(new Report());
    rowFilter.setRowAlias(rowAlias);
   
    ArrayList<RowAliasFilter> filters = new ArrayList<RowAliasFilter>();
    filters.add(rowFilter);
   
View Full Code Here

    rowAlias.setAlias("alias");
   
    RowAliasFilter rowFilter = new RowAliasFilter();
    rowFilter.setId(1);
    rowFilter.setFilterType(new FilterType(1, "Less Than"));
    rowFilter.setReport(new Report());
    rowFilter.setRowAlias(rowAlias);
   
    ArrayList<RowAliasFilter> filters = new ArrayList<RowAliasFilter>();
    filters.add(rowFilter);
   
View Full Code Here

    rowAlias.setAlias("alias");
   
    RowAliasFilter rowFilter = new RowAliasFilter();
    rowFilter.setId(1);
    rowFilter.setFilterType(new FilterType(1, "Less Than"));
    rowFilter.setReport(new Report());
    rowFilter.setRowAlias(rowAlias);
   
    RowAlias rowAlias1 = new RowAlias();
    rowAlias1.setId(2);
    rowAlias1.setAlias("alias1");
   
    RowAliasFilter rowFilter1 = new RowAliasFilter();
    rowFilter1.setId(2);
    rowFilter1.setFilterType(new FilterType(1, "Equals"));
    rowFilter1.setReport(new Report());
    rowFilter1.setRowAlias(rowAlias1);
   
    ArrayList<RowAliasFilter> filters = new ArrayList<RowAliasFilter>();
    filters.add(rowFilter);
    filters.add(rowFilter1);
View Full Code Here

    rowAlias.setAlias("alias");
   
    RowAliasFilter rowFilter = new RowAliasFilter();
    rowFilter.setId(1);
    rowFilter.setFilterType(new FilterType(1, "Equals"));
    rowFilter.setReport(new Report());
    rowFilter.setRowAlias(rowAlias);
   
    RowAlias rowAlias1 = new RowAlias();
    rowAlias1.setId(2);
    rowAlias1.setAlias("alias1");
   
    RowAliasFilter rowFilter1 = new RowAliasFilter();
    rowFilter1.setId(2);
    rowFilter1.setFilterType(new FilterType(1, "Less Than"));
    rowFilter1.setReport(new Report());
    rowFilter1.setRowAlias(rowAlias1);
   
    ArrayList<RowAliasFilter> filters = new ArrayList<RowAliasFilter>();
    filters.add(rowFilter);
    filters.add(rowFilter1);
View Full Code Here

TOP

Related Classes of co.nubetech.crux.model.Report

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.