Examples of CDefinition


Examples of com.pardot.rhombus.cobject.CDefinition

        // Hardcode this for simplicity
        ShardingStrategyMonthly shardStrategy = new ShardingStrategyMonthly();

        // SSTableWriter craps out if we try to close a writer on a table and then create a new one on the same table, so each test should write to different tables
        Map<String, CDefinition> tableDefs = keyspaceDefinition.getDefinitions();
        CDefinition def = tableDefs.get(defaultTableName);
        def.setName(testUniqueTableName);
        tableDefs.remove(defaultTableName);
        tableDefs.put(testUniqueTableName, def);

        // Make sure the SSTableOutput directory exists and is clear
        File keyspaceDir = new File(keyspaceName);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CDefinition

        // Hardcode this for simplicity
        ShardingStrategyMonthly shardStrategy = new ShardingStrategyMonthly();

        // SSTableWriter craps out if we try to close a writer on a table and then create a new one on the same table, so each test should write to different tables
        Map<String, CDefinition> tableDefs = keyspaceDefinition.getDefinitions();
        CDefinition def = tableDefs.get(defaultTableName);
        def.setName(testUniqueTableName);
        tableDefs.remove(defaultTableName);
        tableDefs.put(testUniqueTableName, def);

        // Make sure the SSTableOutput directory exists and is clear
        File keyspaceDir = new File(keyspaceName);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CDefinition

        assertNotNull(keyspaceDefinition);
        String keyspaceName = keyspaceDefinition.getName();

        // SSTableWriter craps out if we try to close a writer on a table and then create a new one on the same table, so each test should write to different tables
        Map<String, CDefinition> tableDefs = keyspaceDefinition.getDefinitions();
        CDefinition def = tableDefs.get(defaultTableName);
        def.setName(testUniqueTableName);
        tableDefs.remove(defaultTableName);
        tableDefs.put(testUniqueTableName, def);

        // Make sure the SSTableOutput directory exists and is clear
        File keyspaceDir = new File(keyspaceName);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CDefinition

    cm.buildKeyspace(definition, true);
    cm.setDefaultKeyspace(definition);
    ObjectMapper om = cm.getObjectMapper();
    om.truncateTables();

    CDefinition def1 = om.getKeyspaceDefinition_ONLY_FOR_TESTING().getDefinitions().get("testtype");
    //do an insert on an object
    Map<String, Object> testObject = Maps.newTreeMap();
    testObject.put("foreignid", Long.valueOf(100));
    testObject.put("type", Integer.valueOf(101));
    testObject.put("instance", Long.valueOf(102));
    testObject.put("filtered", Integer.valueOf(103));
    testObject.put("data1", "This is data 1");
    testObject.put("data2", "This is data 2");
    testObject.put("data3", "This is data 3");

    UUID key = (UUID)om.insert("testtype", testObject);

    testObject.put("foreignid", Long.valueOf(200));
    testObject.put("type", Integer.valueOf(201));
    testObject.put("instance", Long.valueOf(202));
    testObject.put("filtered", Integer.valueOf(203));

    //manually insert that object incorrectly into other indexes
    List<CQLStatement> insertStatements = Lists.newArrayList();
    for(CIndex i : def1.getIndexes().values()){
      om.getCqlGenerator_ONLY_FOR_TESTING().addCQLStatmentsForIndexInsert(
          keyspace,
          true,
          insertStatements,
          def1,
          testObject,
          i,
          key,
          om.getCqlGenerator_ONLY_FOR_TESTING().makeFieldAndValueList(def1, testObject), null, null);
    }
    for(CQLStatement s: insertStatements){
      om.getCqlExecutor().executeSync(s);
    }

    //manually record those incorrect values in the update table
    CQLStatement cql = om.getCqlGenerator_ONLY_FOR_TESTING().makeInsertUpdateIndexStatement(
        keyspace,
        def1,
        key, def1.makeIndexValues(testObject));
    om.getCqlExecutor().executeSync(cql);

    //now manually record an update back to the original in the update table to simulate an eventual consistency issue
    Map<String, Object> testObjectOriginal = Maps.newTreeMap();
    testObjectOriginal.put("foreignid", Long.valueOf(100));
    testObjectOriginal.put("type", Integer.valueOf(101));
    testObjectOriginal.put("instance", Long.valueOf(102));
    testObjectOriginal.put("filtered", Integer.valueOf(103));
    testObjectOriginal.put("data1", "This is data 1");
    testObjectOriginal.put("data2", "This is data 2");
    testObjectOriginal.put("data3", "This is data 3");
    cql = om.getCqlGenerator_ONLY_FOR_TESTING().makeInsertUpdateIndexStatement(
        definition.getName(),
        def1,
        key, def1.makeIndexValues(testObjectOriginal));
    om.getCqlExecutor().executeSync(cql);

    //verify that the object returns different values in the static table and on those (or some of those) indexes
    Map<String, Object> staticTableObject = om.getByKey("testtype", key);
    assertEquals(100L,staticTableObject.get("foreignid"));
View Full Code Here

Examples of com.pardot.rhombus.cobject.CDefinition

        // Hardcode this for simplicity
        ShardingStrategyNone shardStrategy = new ShardingStrategyNone();

        // SSTableWriter craps out if we try to close a writer on a table and then create a new one on the same table, so each test should write to different tables
        Map<String, CDefinition> tableDefs = keyspaceDefinition.getDefinitions();
        CDefinition def = tableDefs.get(defaultTableName);
        def.setName(testUniqueTableName);
        tableDefs.remove(defaultTableName);
        tableDefs.put(testUniqueTableName, def);

        // Make sure the SSTableOutput directory exists and is clear
        File keyspaceDir = new File(keyspaceName);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CDefinition

    //Rebuild the keyspace and get the object mapper
    cm.buildKeyspace(definition, true);
    cm.setDefaultKeyspace(definition);
    ObjectMapper om = cm.getObjectMapper();
    CDefinition def1 = om.getKeyspaceDefinition_ONLY_FOR_TESTING().getDefinitions().get("testtype");


    //do an insert on an object
    //make some objects to insert
    List<Map<String,Object>> toInserts = Lists.newArrayList();
View Full Code Here

Examples of com.pardot.rhombus.cobject.CDefinition

    final ObjectMapper om = cm.getObjectMapper();

    final int numThreads = 10;
    final ExecutorService executorService = Executors.newFixedThreadPool(numThreads);
    List<Map<String, Object>> values = JsonUtil.rhombusMapFromResource(this.getClass().getClassLoader(), "DateRangeQueryTestData.js");
    final CDefinition objectAuditDef = definition.getDefinitions().get("object_audit");

    //Run through the inserts a few times and get a total time to execute
    long startTime = System.currentTimeMillis();
    for(int i = 0 ; i < 100 ; i++) {
      insertObjectSetAsync(numThreads, executorService, om, values, objectAuditDef);
View Full Code Here

Examples of com.pardot.rhombus.cobject.CDefinition

*/
public class CDefinitionTest extends TestCase{

    public void testFields() throws IOException {
        String json = TestHelpers.readFileToString(this.getClass(), "CObjectCQLGeneratorTestData.js");
        CDefinition def = CDefinition.fromJsonString(json);
        Map<String, CField> fields = def.getFields();
        //Make sure the size is correct
        assertEquals(7, fields.size());
        //Check the first field
        CField field = fields.get("foreignid");
        assertEquals("foreignid", field.getName());
View Full Code Here

Examples of com.pardot.rhombus.cobject.CDefinition

        assertEquals(CField.CDataType.BIGINT, field.getType());
    }

  public void testEquals() throws IOException {
    String json = TestHelpers.readFileToString(this.getClass(), "CObjectCQLGeneratorTestData.js");
    CDefinition def1 = CDefinition.fromJsonString(json);
    CDefinition def2 = CDefinition.fromJsonString(json);
    assertTrue(def1.equals(def2));
  }
View Full Code Here

Examples of com.pardot.rhombus.cobject.CDefinition

    assertTrue(def1.equals(def2));
  }

  public void testNotEquals() throws IOException {
    String json = TestHelpers.readFileToString(this.getClass(), "CObjectCQLGeneratorTestData.js");
    CDefinition def1 = CDefinition.fromJsonString(json);
    CDefinition def2 = CDefinition.fromJsonString(json);
    def2.setName("Other name");
    assertFalse(def1.equals(def2));
  }
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.