Package com.alvazan.orm.api.z8spi.meta

Examples of com.alvazan.orm.api.z8spi.meta.TypedRow


    log.info("testTimeSeries");

    NoSqlTypedSession s = mgr.getTypedSession();
   
    String cf = "TimeSeriesData";
    TypedRow row = s.createTypedRow(cf);
    row.setRowKey(BigInteger.valueOf(25));
    row.addColumn("temp", new BigDecimal(55.6));
    row.addColumn("someName", "dean");
   
    s.put(cf, row);
    s.flush();
   
    //NOW, let's find the row we put
    TypedRow result = s.find(cf, row.getRowKey());
    Assert.assertEquals(row.getRowKey(), result.getRowKey());
    Assert.assertEquals(row.getColumn("temp").getValue(), result.getColumn("temp").getValue());
    Assert.assertEquals(row.getColumn("someName").getValue(), result.getColumn("someName").getValue());
   
    Cursor<KeyValue<TypedRow>> rowsIter = s.createQueryCursor("select s FROM TimeSeriesData as s where s.key = 25", 500).getPrimaryViewCursor();
    rowsIter.next();
    KeyValue<TypedRow> keyValue = rowsIter.getCurrent();
    TypedRow theRow = keyValue.getValue();
    Assert.assertEquals(row.getRowKey(), theRow.getRowKey());
    Assert.assertEquals(row.getColumn("temp").getValue(), theRow.getColumn("temp").getValue());

    //Testing a negative value in the SQL here
    Cursor<KeyValue<TypedRow>> rows2 = s.createQueryCursor("select s FROM TimeSeriesData as s where s.key > -25", 500).getPrimaryViewCursor();
    rows2.next();
    KeyValue<TypedRow> keyValue2 = rows2.getCurrent();
    TypedRow theRow2 = keyValue2.getValue();
    Assert.assertEquals(row.getRowKey(), theRow2.getRowKey());
    Assert.assertEquals(row.getColumn("temp").getValue(), theRow2.getColumn("temp").getValue());
  }
View Full Code Here


    NoSqlTypedSession session = mgr.getTypedSession();
   
    String sql = "select * FROM MyEntity as e WHERE e.cat = \"deano\"";

    TypedRow typedRow = session.createTypedRow("MyEntity");

    typedRow.addColumn("cat", "deano");
    typedRow.setRowKey("dean1");
   
    session.put("MyEntity", typedRow);
   
    session.flush();
   
View Full Code Here

    mgr.put(meta);
    mgr.put(tm);

    mgr.flush();
   
    TypedRow row = typedSession.createTypedRow(colFamily);
    BigInteger rowKey = new BigInteger("0");
    row.setRowKey(rowKey);
    row.addTimeValue(0, new BigDecimal(56));
    row.addTimeValue(10, new BigDecimal(56));
    row.addTimeValue(20, new BigDecimal(56));
    row.addTimeValue(30, new BigDecimal(56));
    row.addTimeValue(40, new BigDecimal(56));
    row.addTimeValue(50, new BigDecimal(56));
    row.addTimeValue(60, new BigDecimal(56));
    row.addTimeValue(70, new BigDecimal(56));
    row.addTimeValue(80, new BigDecimal(56));
    row.addTimeValue(90, new BigDecimal(56));
    row.addTimeValue(100, new BigDecimal(56));

    typedSession.put(colFamily, row);
    typedSession.flush();
   
    Cursor<TimeValColumn> timeVal = typedSession.timeSeriesSlice(colFamily, rowKey, 40, 60, 200);
View Full Code Here

    NoSqlTypedSession s = mgr.getTypedSession();
    QueryResult result = s.createQueryCursor(sql, 10); // only need last
    Cursor<KeyValue<TypedRow>> cursor = result.getPrimaryViewCursor();
    cursor.beforeFirst();
    List<TypedRow> list = new ArrayList<TypedRow>();
    TypedRow myRow = null;
    while(cursor.next()) {
      list.add(cursor.getCurrent().getValue());
      if("email1".equals(cursor.getCurrent().getKey()))
        myRow = cursor.getCurrent().getValue();
    }
    Assert.assertEquals(3, list.size());
   
    Assert.assertEquals("anemail1", myRow.getColumn("name").getValue());
  }
View Full Code Here

    Cursor<List<TypedRow>> rows = result.getAllViewsCursor();
   
    rows.next();
    List<TypedRow> joinedRow = rows.getCurrent();
   
    TypedRow typedRow = joinedRow.get(0);
    TypedRow theJoinedRow = joinedRow.get(1);
   
    log.info("joinedRow="+joinedRow);
    Assert.assertEquals("e", typedRow.getView().getAlias());
    Assert.assertEquals("act1", typedRow.getRowKeyString());
    Assert.assertEquals("acc1", theJoinedRow.getRowKey());
   
    rows.next();
    joinedRow = rows.getCurrent();
   
    typedRow = joinedRow.get(0);
    theJoinedRow = joinedRow.get(1);
   
    log.info("joinedRow="+joinedRow);
    Assert.assertEquals("e", typedRow.getView().getAlias());
    Assert.assertEquals("act7", typedRow.getRowKeyString());
    Assert.assertEquals("acc1", theJoinedRow.getRowKey());
  }
View Full Code Here

    rows.afterLast();
   
    rows.previous();
    List<TypedRow> joinedRow = rows.getCurrent();
   
    TypedRow typedRow = joinedRow.get(0);
    TypedRow theJoinedRow = joinedRow.get(1);
   
    log.info("joinedRow="+joinedRow);
    Assert.assertEquals("e", typedRow.getView().getAlias());
    Assert.assertEquals("act7", typedRow.getRowKeyString());
    Assert.assertEquals("acc1", theJoinedRow.getRowKey());
   
    rows.previous();
    joinedRow = rows.getCurrent();
   
    typedRow = joinedRow.get(0);
    theJoinedRow = joinedRow.get(1);
   
    log.info("joinedRow="+joinedRow);
    Assert.assertEquals("e", typedRow.getView().getAlias());
    Assert.assertEquals("act1", typedRow.getRowKeyString());
    Assert.assertEquals("acc1", theJoinedRow.getRowKey());
  }
View Full Code Here

    rows.afterLast();
   
    rows.previous();
    List<TypedRow> joinedRow = rows.getCurrent();
   
    TypedRow typedRow = joinedRow.get(0);
    TypedRow theJoinedRow = joinedRow.get(1);
   
    log.info("joinedRow="+joinedRow);
    Assert.assertEquals("e", typedRow.getView().getAlias());
    Assert.assertEquals("act7", typedRow.getRowKeyString());
    Assert.assertEquals("acc1", theJoinedRow.getRowKey());
   
    rows.previous();
    joinedRow = rows.getCurrent();
   
    typedRow = joinedRow.get(0);
    theJoinedRow = joinedRow.get(1);
   
    log.info("joinedRow="+joinedRow);
    Assert.assertEquals("e", typedRow.getView().getAlias());
    Assert.assertEquals("act1", typedRow.getRowKeyString());
    Assert.assertEquals("acc1", theJoinedRow.getRowKey());
  }
View Full Code Here

   
    rows.next();
    List<TypedRow> joinedRow = rows.getCurrent();
    Assert.assertEquals(1, joinedRow.size());
   
    TypedRow typedRow = joinedRow.get(0);

    log.info("joinedRow="+joinedRow);
    Assert.assertEquals("e", typedRow.getView().getAlias());
    Assert.assertEquals("act1", typedRow.getRowKeyString());
  }
View Full Code Here

    Cursor<List<TypedRow>> rows = result.getAllViewsCursor();
   
    rows.next();
    List<TypedRow> joinedRow = rows.getCurrent();
   
    TypedRow typedRow = joinedRow.get(0);
    TypedRow theJoinedRow = joinedRow.get(1);
   
    log.info("joinedRow="+joinedRow);
    Assert.assertEquals("e", typedRow.getView().getAlias());
    Assert.assertEquals("act1", typedRow.getRowKeyString());
    Assert.assertEquals("acc1", theJoinedRow.getRowKey());
  }
View Full Code Here

    Cursor<List<TypedRow>> rows = result.getAllViewsCursor();
   
    rows.next();
    List<TypedRow> joinedRow = rows.getCurrent();
   
    TypedRow typedRow = joinedRow.get(0);
    TypedRow theJoinedRow = joinedRow.get(1);
   
    log.info("joinedRow="+joinedRow);
    Assert.assertEquals("e", typedRow.getView().getAlias());
    Assert.assertEquals("act1", typedRow.getRowKeyString());
    Assert.assertEquals("acc1", theJoinedRow.getRowKey());
   
      rows.next();
      List<TypedRow> joinedRow1 = rows.getCurrent();
      TypedRow typedRow1 = joinedRow1.get(0);
      TypedRow theJoinedRow1 = joinedRow1.get(1);
      log.info("joinedRow1= "+joinedRow1);
      Assert.assertEquals("e", typedRow1.getView().getAlias());
      Assert.assertEquals("act5", typedRow1.getRowKeyString());
      Assert.assertEquals(null, theJoinedRow1.getRowKey());

      rows.next();
      List<TypedRow> joinedRow2 = rows.getCurrent();
      TypedRow typedRow2 = joinedRow2.get(0);
      TypedRow theJoinedRow2 = joinedRow2.get(1);
      log.info("joinedRow1= "+joinedRow2);
      Assert.assertEquals("e", typedRow2.getView().getAlias());
      Assert.assertEquals("act7", typedRow2.getRowKeyString());
      Assert.assertEquals("acc1", theJoinedRow2.getRowKey());
  }
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z8spi.meta.TypedRow

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.