Package com.pardot.rhombus.cobject.statement

Examples of com.pardot.rhombus.cobject.statement.CQLStatement


    CQLStatement statement2 = CQLStatement.make(query2, objectName);
    assertEquals(1, statement1.compareTo(statement2));
  }

  public void testEqualsDifferentClass() {
    CQLStatement statement1 = CQLStatement.make(query, objectName);
    Integer notStatement = new Integer(1);
    assertFalse(statement1.equals(notStatement));
  }
View Full Code Here


    Integer notStatement = new Integer(1);
    assertFalse(statement1.equals(notStatement));
  }

  public void testEqualsDifferentQuery() {
    CQLStatement statement1 = CQLStatement.make(query, objectName);
    CQLStatement statement2 = CQLStatement.make(query2, objectName);
    assertFalse(statement1.equals(statement2));
  }
View Full Code Here

    CQLStatement statement2 = CQLStatement.make(query2, objectName);
    assertFalse(statement1.equals(statement2));
  }

  public void testEqualsNullValue() {
    CQLStatement statement1 = CQLStatement.make(query, objectName);
    CQLStatement statement2 = CQLStatement.make(query, objectName, values);
    assertFalse(statement1.equals(statement2));
  }
View Full Code Here

    CQLStatement statement2 = CQLStatement.make(query, objectName, values);
    assertFalse(statement1.equals(statement2));
  }

  public void testEqualsDifferentValues() {
    CQLStatement statement1 = CQLStatement.make(query, objectName, values);
    CQLStatement statement2 = CQLStatement.make(query, objectName, values2);
    assertFalse(statement1.equals(statement2));
  }
View Full Code Here

    CQLStatement statement2 = CQLStatement.make(query, objectName, values2);
    assertFalse(statement1.equals(statement2));
  }

  public void testEquals() {
    CQLStatement statement1 = CQLStatement.make(query, objectName, values);
    CQLStatement statement2 = CQLStatement.make(query, objectName, values);
    assertTrue(statement1.equals(statement2));
  }
View Full Code Here

    CQLStatement statement2 = CQLStatement.make(query, objectName, values);
    assertTrue(statement1.equals(statement2));
  }

  public void testToString() {
    CQLStatement statement1 = CQLStatement.make(query, objectName);
    String expected = "Query: insert into object (field1, field2) values (?, ?);\n" +
        "Values: null\n" +
        "Preparable: false";
    assertEquals(expected, statement1.toString());
  }
View Full Code Here

        "Preparable: false";
    assertEquals(expected, statement1.toString());
  }

  public void testToStringValues() {
    CQLStatement statement1 = CQLStatement.make(query, objectName, values);
    String expected = "Query: insert into object (field1, field2) values (?, ?);\n" +
        "Values: [\n" +
        "    value1 (class java.lang.String) ,\n" +
        "    value2 (class java.lang.String) \n" +
        "\n" +
        "]\n" +
        "Preparable: true";
    assertEquals(expected, statement1.toString());
  }
View Full Code Here

    assertEquals(expected, statement1.toString());
  }


  public void testGetSetObjectName() {
    CQLStatement statement = CQLStatement.make(query, objectName);
    statement.setObjectName(objectName);
    assertEquals(objectName, objectName);
  }
View Full Code Here

    public void testMakeStaticTableCreate() throws CObjectParseException, IOException {
      String json = TestHelpers.readFileToString(this.getClass(), "CObjectCQLGeneratorTestData.js");
      CDefinition def = CDefinition.fromJsonString(json);
      Subject subject = new Subject(1000);
      CQLStatement cql = subject.makeStaticTableCreate(def);
      CQLStatement expected = CQLStatement.make(
          "CREATE TABLE \"testspace\".\"testtype\" (id timeuuid PRIMARY KEY, filtered int,data1 varchar,data2 varchar,data3 varchar,instance bigint,type int,foreignid bigint);",
          TABLE_NAME
      );
      assertEquals(expected, cql);
    }
View Full Code Here

    public void testMakeWideTableCreate() throws CObjectParseException, IOException {
      String json = TestHelpers.readFileToString(this.getClass(), "CObjectCQLGeneratorTestData.js");
      CDefinition def = CDefinition.fromJsonString(json);
      Subject subject = new Subject(1000);
      CQLStatement cql1 = subject.makeWideTableCreate(def, def.getIndexes().get("foreignid"));
      CQLStatement expected1 = CQLStatement.make(
          "CREATE TABLE \"testspace\".\"testtype7f9bb4e56d3cae5b11c553547cfe5897\" (id timeuuid, shardid bigint, filtered int,data1 varchar,data2 varchar,data3 varchar,instance bigint,type int,foreignid bigint, PRIMARY KEY ((shardid, foreignid),id) );",
          TABLE_NAME
      );
      assertEquals(expected1, cql1);

      CQLStatement cql2 = subject.makeWideTableCreate(def, def.getIndexes().get("instance:type"));
      CQLStatement expected2 = CQLStatement.make(
          "CREATE TABLE \"testspace\".\"testtype6671808f3f51bcc53ddc76d2419c9060\" (id timeuuid, shardid bigint, filtered int,data1 varchar,data2 varchar,data3 varchar,instance bigint,type int,foreignid bigint, PRIMARY KEY ((shardid, instance, type),id) );",
          TABLE_NAME
      );
      assertEquals(expected2, cql2);

      CQLStatement cql3 = subject.makeWideTableCreate(def, def.getIndexes().get("foreignid:instance:type"));
      CQLStatement expected3 =  CQLStatement.make(
          "CREATE TABLE \"testspace\".\"testtypef9bf3332bb4ec879849ec43c67776131\" (id timeuuid, shardid bigint, filtered int,data1 varchar,data2 varchar,data3 varchar,instance bigint,type int,foreignid bigint, PRIMARY KEY ((shardid, foreignid, instance, type),id) );",
          TABLE_NAME
      );
      assertEquals(expected3, cql3);
    }
View Full Code Here

TOP

Related Classes of com.pardot.rhombus.cobject.statement.CQLStatement

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.