Examples of TDHSResponse


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

    public void testHundredThousand() throws TDHSException {
        TableInfo tableInfo = new TableInfo(db, table, null,
                new String[]{fields[0]});
        Get get = new Get(tableInfo, new String[][]{{"-1"}},
                TDHSCommon.FindFlag.TDHS_GE, 0, 100000);
        TDHSResponse r = client.count(get);
        Assert.assertEquals(TDHSResponseEnum.ClientStatus.OK, r.getStatus());
        Assert.assertEquals(1, r.getFieldData().size());
        Assert.assertEquals("100000", r.getFieldData().get(0).get(0));
    }
View Full Code Here

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

        Assert.assertEquals("100000", r.getFieldData().get(0).get(0));
    }

    @Test
    public void testCustom() throws TDHSException {
        TDHSResponse r = client.query().use(db).from(table).where().lessEqual("9898").count();
        Assert.assertEquals(TDHSResponseEnum.ClientStatus.OK, r.getStatus());
        Assert.assertEquals(1, r.getFieldData().size());
        Assert.assertEquals("9898", r.getFieldData().get(0).get(0));
    }
View Full Code Here

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

        Assert.assertEquals("9898", r.getFieldData().get(0).get(0));
    }

    @Test
    public void testAllCustom() throws TDHSException {
        TDHSResponse r = client.query().use(db).from(table).where().lessEqual("1989800").count();
        Assert.assertEquals(TDHSResponseEnum.ClientStatus.OK, r.getStatus());
        Assert.assertEquals(1, r.getFieldData().size());
        Assert.assertEquals("100000", r.getFieldData().get(0).get(0));
    }
View Full Code Here

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

        Assert.assertEquals("100000", r.getFieldData().get(0).get(0));
    }

    @Test
    public void testCustom2() throws TDHSException {
        TDHSResponse r = client.query().use(db).from(table).where().lessEqual("1989800").and().field("id").greaterThan(
                "1000").count();
        Assert.assertEquals(TDHSResponseEnum.ClientStatus.OK, r.getStatus());
        Assert.assertEquals(1, r.getFieldData().size());
        Assert.assertEquals("99000", r.getFieldData().get(0).get(0));
    }
View Full Code Here

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

import com.taobao.tdhs.client.response.TDHSResponseEnum.ClientStatus;

public class EasyUpdateTest extends TestBase {
  @Test
  public void testNoRecords() throws TDHSException {
    TDHSResponse r = client.query().use(db).from(table).set().field("name")
        .set("ccc").where().equal("1").update();
    Assert.assertEquals("0", r.getFieldData().get(0).get(0));
    Assert.assertEquals(ClientStatus.OK, r.getStatus());

    r = client.query().use(db).from(table).set().field("name").add(1213)
        .where().equal("1").update();
    Assert.assertEquals("0", r.getFieldData().get(0).get(0));
    Assert.assertEquals(ClientStatus.OK, r.getStatus());

    r = client.query().use(db).from(table).set().field("name").sub(1213)
        .where().equal("1").update();
    Assert.assertEquals("0", r.getFieldData().get(0).get(0));
    Assert.assertEquals(ClientStatus.OK, r.getStatus());
  }
View Full Code Here

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

    Assert.assertEquals(ClientStatus.OK, r.getStatus());
  }

  @Test
  public void testNoFields() throws TDHSException {
    TDHSResponse r = client.query().use(db).from(table).set()
        .field("NoThisFields").set("ccc").where().equal("1").update();
    Assert.assertEquals(ClientStatus.NOT_FOUND, r.getStatus());
  }
View Full Code Here

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

import com.taobao.tdhs.client.response.TDHSResponse;
import com.taobao.tdhs.client.response.TDHSResponseEnum.ClientStatus;

public class EasyDeleteTest extends TestBase {
  private void prepare() throws TDHSException {
    TDHSResponse r = client.insert().use(db).from(table)
        .value(fields[0], "100").value(fields[1], "name_100")
        .value(fields[2], "1000").insert();
    Assert.assertEquals(ClientStatus.OK, r.getStatus());

    client.insert().use(db).from(table).value(fields[0], "200")
        .value(fields[1], "name_200").value(fields[2], "2000").insert();
    Assert.assertEquals(ClientStatus.OK, r.getStatus());

    client.insert().use(db).from(table).value(fields[0], "300")
        .value(fields[1], "name_300").value(fields[2], "3000").insert();
    Assert.assertEquals(ClientStatus.OK, r.getStatus());

    client.insert().use(db).from(table).value(fields[0], "400")
        .value(fields[1], "name_400").value(fields[2], "4000").insert();
    Assert.assertEquals(ClientStatus.OK, r.getStatus());

    client.insert().use(db).from(table).value(fields[0], "500")
        .value(fields[1], "name_500").value(fields[2], "5000").insert();
    Assert.assertEquals(ClientStatus.OK, r.getStatus());
  }
View Full Code Here

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

    Assert.assertEquals(ClientStatus.OK, r.getStatus());
  }

  @Test
  public void testNoRecords() throws TDHSException {
    TDHSResponse r = client.query().use(db).from(table).where()
        .in(new String[] { "1", "2", "3" }).delete();
    Assert.assertEquals(ClientStatus.NOT_FOUND, r.getStatus());
  }
View Full Code Here

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

    Assert.assertEquals(ClientStatus.NOT_FOUND, r.getStatus());
  }

  @Test
  public void testPartRecords() throws TDHSException {
    TDHSResponse r = client.query().use(db).from(table).where()
        .in(new String[] { "100", "200", "3" }).delete();
    Assert.assertEquals(ClientStatus.NOT_FOUND, r.getStatus());
  }
View Full Code Here

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

  @Test
  public void testAllRecords() throws TDHSException {
    prepare();

    TDHSResponse r = client.query().use(db).from(table).select(fields)
        .where().in(new String[] { "100" }).delete();
    Assert.assertEquals("1", r.getFieldData().get(0).get(0));
    Assert.assertEquals(ClientStatus.OK, r.getStatus());

    r = client.query().use(db).from(table).select(fields).where()
        .greaterThan("100").delete();
    Assert.assertEquals("4", r.getFieldData().get(0).get(0));
    Assert.assertEquals(ClientStatus.OK, r.getStatus());
  }
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.