Examples of TDHSResponse


Examples of com.taobao.tdhs.client.response.TDHSResponse

   */
  @Test
  public void test03Get() throws TDHSException {
    List<String> key = new ArrayList<String>(1);
    key.add(name);
    TDHSResponse response = client.query().use(db).from(table)
        .select(fields).where().index(index).in(key).and()
        .field(fields[2]).not("0").limit(0, 100).get();

    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    // 1. response.getFieldData() return List<List<String>>
    // 2. List<String> 存放单字段的值
    // 3. 外层List 存放(2)的集合数据
    Assert.assertEquals(id, response.getFieldData().get(0).get(0));
    Assert.assertEquals(name, response.getFieldData().get(0).get(1));
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

   * update unit_test set level=level+1 where id=9999
   */
  @Test
  public void test04Update() throws TDHSException {
    level = Integer.parseInt(level) + 1 + "";
    TDHSResponse response = client.query().use(db).from(table).set()
        .field(fields[2]).add(1).where().equal(id).update();

    Assert.assertEquals("1", response.getFieldData().get(0).get(0));
    Assert.assertEquals(ClientStatus.OK, response.getStatus());
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

  /**
   * select id,name,level from unit_test where id=9999 and level=100
   */
  @Test
  public void test05Get() throws TDHSException {
    TDHSResponse response = client.query().use(db).from(table)
        .select(fields).where().in(new String[] { id }).and()
        .field(fields[2]).equal(level).get();

    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(response.getFieldData().get(0).size(),
        response.getFieldNumber());
    Assert.assertEquals(level, response.getFieldData().get(0).get(2));
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

   * update unit_test set level=level-1 where id=9999
   */
  @Test
  public void test06Update() throws TDHSException {
    level = Integer.parseInt(level) - 1 + "";
    TDHSResponse response = client.query().use(db).from(table).set()
        .field(fields[2]).sub(1).where().equal(id).update();

    Assert.assertEquals("1", response.getFieldData().get(0).get(0));
    Assert.assertEquals(ClientStatus.OK, response.getStatus());
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

  /**
   * select id,name,level from unit_test where id<=9999 and level<=99
   */
  @Test
  public void test07Get() throws TDHSException {
    TDHSResponse response = client.query().use(db).from(table)
        .select(fields).where().lessEqual(id).and().field(fields[2])
        .lessEqual(level).get();

    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(1, response.getFieldData().size());
    Assert.assertEquals(level, response.getFieldData().get(0).get(2));
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

  /**
   * select id,name,level from unit_test where id<9999 and level<99
   */
  @Test
  public void test08Get() throws TDHSException {
    TDHSResponse response = client.query().use(db).from(table)
        .select(fields).where().lessThan(id).and().field(fields[2])
        .lessThan(level).get();

    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(0, response.getFieldData().size());
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

  /**
   * select id,name,level from unit_test where id>=9999 and level>=99
   */
  @Test
  public void test09Get() throws TDHSException {
    TDHSResponse response = client.query().use(db).from(table)
        .select(fields).where().greaterEqual(id).and().field(fields[2])
        .greaterEqual(level).get();

    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(1, response.getFieldData().size());
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

  /**
   * select id,name,level from unit_test where id>9999 and level>99
   */
  @Test
  public void test10Get() throws TDHSException {
    TDHSResponse response = client.query().use(db).from(table)
        .select(fields).where().greaterThan(id).and().field(fields[2])
        .greaterThan(level).get();

    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(0, response.getFieldData().size());
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

  /**
   * select id,name,level from unit_test where id = 1 and level != 99
   */
  @Test
  public void test11Get() throws TDHSException {
    TDHSResponse response = client.query().use(db).from(table)
        .select(fields).where().equal(id).and().field(fields[2])
        .not("1").get();

    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(1, response.getFieldData().size());

    response = client.query().use(db).from(table).select(fields).where()
        .equal(id).and().field(fields[2]).not(level).get();

    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(0, response.getFieldData().size());
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

   * <li>select id,name,level from unit_test where id < 9999</li>
   * <ol>
   */
  @Test
  public void test12Get() throws TDHSException {
    TDHSResponse response = client.query().use(db).from(table)
        .select(fields).where().greaterEqual(id).get();
    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(1, response.getFieldData().size());

    response = client.query().use(db).from(table).select(fields).where()
        .greaterThan(id).get();
    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(0, response.getFieldData().size());

    response = client.query().use(db).from(table).select(fields).where()
        .lessEqual(id).get();
    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(1, response.getFieldData().size());

    response = client.query().use(db).from(table).select(fields).where()
        .lessThan(id).get();
    Assert.assertEquals(ClientStatus.OK, response.getStatus());
    Assert.assertEquals(0, response.getFieldData().size());
  }
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.