Package org.cassandraunit.model

Examples of org.cassandraunit.model.ColumnModel


        /* row1 */
        RowModel row = new RowModel();
        row.setKey(new GenericType("rowWithNullColumnValue", GenericTypeEnum.UTF_8_TYPE));

        /* column1 */
        ColumnModel column1 = new ColumnModel();
        column1.setName(new GenericType("columnWithNullValue",GenericTypeEnum.UTF_8_TYPE));
        row.getColumns().add(column1);

        columnFamily.getRows().add(row);
        keyspace.getColumnFamilies().add(columnFamily);

View Full Code Here


        /* row1 */
        RowModel row = new RowModel();
        row.setKey(new GenericType("rowWithTimestampedColumn", GenericTypeEnum.UTF_8_TYPE));

        /* column1 */
        ColumnModel column1 = new ColumnModel();
        column1.setName(new GenericType("columnWithTimestamp",GenericTypeEnum.UTF_8_TYPE));
        column1.setTimestamp(new Long(2020L));
        row.getColumns().add(column1);

        columnFamily.getRows().add(row);
        keyspace.getColumnFamilies().add(columnFamily);

View Full Code Here

    /* row1 */
        RowModel row1 = new RowModel();
        row1.setKey(new GenericType("row1", GenericTypeEnum.UTF_8_TYPE));

    /* column1 */
        ColumnModel column1 = new ColumnModel();
        column1.setName(new GenericType("c", GenericTypeEnum.UTF_8_TYPE));
        column1.setValue(new GenericType("c", GenericTypeEnum.UTF_8_TYPE));
        row1.getColumns().add(column1);

    /* column2 */
        ColumnModel column2 = new ColumnModel();
        column2.setName(new GenericType("b", GenericTypeEnum.UTF_8_TYPE));
        column2.setValue(new GenericType("b", GenericTypeEnum.UTF_8_TYPE));
        row1.getColumns().add(column2);

    /* column3 */
        ColumnModel column3 = new ColumnModel();
        column3.setName(new GenericType("a", GenericTypeEnum.UTF_8_TYPE));
        column3.setValue(new GenericType("a", GenericTypeEnum.UTF_8_TYPE));
        row1.getColumns().add(column3);

        columnFamily.getRows().add(row1);
        keyspace.getColumnFamilies().add(columnFamily);
        when(mockDataSet.getKeyspace()).thenReturn(keyspace);
View Full Code Here

        row1.setKey(new GenericType("row1", GenericTypeEnum.UTF_8_TYPE));

        GenericTypeEnum[] columnNameTypes = {GenericTypeEnum.LONG_TYPE, GenericTypeEnum.UTF_8_TYPE, GenericTypeEnum.INTEGER_TYPE};

    /* column1 */
        ColumnModel column1 = new ColumnModel();
        column1.setName(new GenericType(new String[] { "12", "aa", "11" }, columnNameTypes));
        column1.setValue(new GenericType("v6", GenericTypeEnum.UTF_8_TYPE));
        row1.getColumns().add(column1);

    /* column2 */
        ColumnModel column2 = new ColumnModel();
        column2.setName(new GenericType(new String[] { "12", "ab", "12" }, columnNameTypes));
        column2.setValue(new GenericType("v5", GenericTypeEnum.UTF_8_TYPE));
        row1.getColumns().add(column2);

    /* column3 */
        ColumnModel column3 = new ColumnModel();
        column3.setName(new GenericType(new String[] { "12", "ab", "11" }, columnNameTypes));
        column3.setValue(new GenericType("v4", GenericTypeEnum.UTF_8_TYPE));
        row1.getColumns().add(column3);

    /* column4 */
        ColumnModel column4 = new ColumnModel();
        column4.setName(new GenericType(new String[] { "11", "aa", "11" }, columnNameTypes));
        column4.setValue(new GenericType("v3", GenericTypeEnum.UTF_8_TYPE));
        row1.getColumns().add(column4);

    /* column5 */
        ColumnModel column5 = new ColumnModel();
        column5.setName(new GenericType(new String[] { "11", "ab", "12" }, columnNameTypes));
        column5.setValue(new GenericType("v2", GenericTypeEnum.UTF_8_TYPE));
        row1.getColumns().add(column5);

    /* column6 */
        ColumnModel column6 = new ColumnModel();
        column6.setName(new GenericType(new String[] { "11", "ab", "11" }, columnNameTypes));
        column6.setValue(new GenericType("v1", GenericTypeEnum.UTF_8_TYPE));
        row1.getColumns().add(column6);

        columnFamily.getRows().add(row1);
        keyspace.getColumnFamilies().add(columnFamily);
        when(mockDataSet.getKeyspace()).thenReturn(keyspace);
View Full Code Here

        /* row1 */
        RowModel row = new RowModel();
        row.setKey(new GenericType("row1", GenericTypeEnum.UTF_8_TYPE));

        /* column1 */
        ColumnModel column1 = new ColumnModel();
        column1.setName(new GenericType("a", GenericTypeEnum.UTF_8_TYPE));
        column1.setValue(new GenericType("aGVsbG8gd29ybGQh", GenericTypeEnum.BYTES_TYPE));
        row.getColumns().add(column1);

        /* column2 */
        ColumnModel column2 = new ColumnModel();
        column2.setName(new GenericType("b", GenericTypeEnum.UTF_8_TYPE));
        String value2 = "V2VsY29tZSB0byBBcGFjaGUgQ2Fzc2FuZHJhDQoNClRoZSBBcGFjaGUgQ2Fzc2FuZHJhIGRhdGFiYXNlIGlzIHRoZSByaWdodCBjaG9pY2Ugd2hlbiB5b3UgbmVlZCBzY2FsYWJpbGl0eSBhbmQgaGln" +
                "aCBhdmFpbGFiaWxpdHkgd2l0aG91dCBjb21wcm9taXNpbmcgcGVyZm9ybWFuY2UuIExpbmVhciBzY2FsYWJpbGl0eSBhbmQgcHJvdmVuIGZhdWx0LXRvbGVyYW5jZSBvbiBjb21tb2RpdHkgaGFyZHdh" +
                "cmUgb3IgY2xvdWQgaW5mcmFzdHJ1Y3R1cmUgbWFrZSBpdCB0aGUgcGVyZmVjdCBwbGF0Zm9ybSBmb3IgbWlzc2lvbi1jcml0aWNhbCBkYXRhLiBDYXNzYW5kcmEncyBzdXBwb3J0IGZvciByZXBsaWNh" +
                "dGluZyBhY3Jvc3MgbXVsdGlwbGUgZGF0YWNlbnRlcnMgaXMgYmVzdC1pbi1jbGFzcywgcHJvdmlkaW5nIGxvd2VyIGxhdGVuY3kgZm9yIHlvdXIgdXNlcnMgYW5kIHRoZSBwZWFjZSBvZiBtaW5kIG9m" +
                "IGtub3dpbmcgdGhhdCB5b3UgY2FuIHN1cnZpdmUgcmVnaW9uYWwgb3V0YWdlcy4=";
        column2.setValue(new GenericType(value2, GenericTypeEnum.BYTES_TYPE));
        row.getColumns().add(column2);

        columnFamily.getRows().add(row);
        keyspace.getColumnFamilies().add(columnFamily);

View Full Code Here

    @Test
    public void shouldGetAColumnFamilyWithNullColumnValue() {
        DataSet dataSet = new ClassPathYamlDataSet("yaml/dataSetWithNullColumnValue.yaml");
        ColumnFamilyModel columnFamilyModel = dataSet.getColumnFamilies().get(0);
        assertThat(columnFamilyModel.getName(), is("columnFamilyWithNullColumnValue"));
        ColumnModel columnModel = columnFamilyModel.getRows().get(0).getColumns().get(0);
        assertThat(columnModel.getName().getValue(), is("columnWithNullColumnValue"));
        assertThat(columnModel.getValue(), nullValue());
    }
View Full Code Here

   @Test
   public void shouldGetAColumnFamilyWithTimestampedColumn() {
       DataSet dataSet = new ClassPathYamlDataSet("yaml/dataSetWithTimestamp.yaml");
       ColumnFamilyModel columnFamilyModel = dataSet.getColumnFamilies().get(0);
       assertThat(columnFamilyModel.getName(), is("columnFamilyWithTimestampedColumn"));
       ColumnModel columnModel = columnFamilyModel.getRows().get(0).getColumns().get(0);
       assertThat(columnModel.getName().getValue(), is("columnWithTimestamp"));
       assertThat(columnModel.getTimestamp(), is(2020L));
   }
View Full Code Here

    public void shouldGetAColumnFamilyWithMetadataAndFunction() {
        DataSet dataSet = new ClassPathYamlDataSet("yaml/dataSetWithMetadataAndFunctions.yaml");
        ColumnFamilyModel columnFamilyModel = dataSet.getColumnFamilies().get(0);
        assertThat(columnFamilyModel.getName(), is("columnFamilyWithMetadata"));
        List<ColumnModel> columns = columnFamilyModel.getRows().get(0).getColumns();
        ColumnModel column1 = columns.get(0);
        assertThat(column1.getName().getValue(),is("column1"));
        assertThat(column1.getValue().getValue(),is("1"));
        assertThat(column1.getValue().getType(),is(GenericTypeEnum.LONG_TYPE));

        ColumnModel column2 = columns.get(1);
        assertThat(column2.getName().getValue(),is("column2"));
        assertThat(column2.getValue().getValue(),is("2"));
        assertThat(column2.getValue().getType(),is(GenericTypeEnum.LONG_TYPE));

        ColumnModel column3 = columns.get(2);
        assertThat(column3.getName().getValue(),is("column3"));
        assertThat(column3.getValue().getValue(),is("value3"));
        assertThat(column3.getValue().getType(),is(GenericTypeEnum.UTF_8_TYPE));
    }
View Full Code Here

        assertThat(actualSuperColumn, notNullValue());
        assertThat(actualSuperColumn.getName().toString(), is("name11"));
        assertThat(actualSuperColumn.getColumns(), notNullValue());
        assertThat(actualSuperColumn.getColumns().size(), is(2));

        ColumnModel actualColumn0OfRow0 = actualSuperColumn.getColumns().get(0);
        assertThat(actualColumn0OfRow0, notNullValue());
        assertThat(actualColumn0OfRow0.getName().toString(), is("111"));
        assertThat(actualColumn0OfRow0.getValue().toString(), is("value111"));

        ColumnModel actualColumn1OfRow0 = actualSuperColumn.getColumns().get(1);
        assertThat(actualColumn1OfRow0, notNullValue());
        assertThat(actualColumn1OfRow0.getName().toString(), is("112"));
        assertThat(actualColumn1OfRow0.getValue().toString(), is("value112"));

        SuperColumnModel actualSuperColumn1OfRow0 = actualrow0.getSuperColumns().get(1);
        assertThat(actualSuperColumn1OfRow0.getName().toString(), is("name12"));
        assertThat(actualSuperColumn1OfRow0.getColumns(), notNullValue());
        assertThat(actualSuperColumn1OfRow0.getColumns().size(), is(2));

        ColumnModel actualColumn0OfSuperColumn1OofRow0 = actualSuperColumn1OfRow0.getColumns().get(0);
        assertThat(actualColumn0OfSuperColumn1OofRow0, notNullValue());
        assertThat(actualColumn0OfSuperColumn1OofRow0.getName().toString(), is("121"));
        assertThat(actualColumn0OfSuperColumn1OofRow0.getValue().toString(), is("value121"));

        ColumnModel actualColumn1OfSuperColumn1ofRow0 = actualSuperColumn1OfRow0.getColumns().get(1);
        assertThat(actualColumn1OfSuperColumn1ofRow0, notNullValue());
        assertThat(actualColumn1OfSuperColumn1ofRow0.getName().toString(), is("122"));
        assertThat(actualColumn1OfSuperColumn1ofRow0.getValue().toString(), is("value122"));

        RowModel row1 = dataSet.getColumnFamilies().get(0).getRows().get(1);
        assertThat(row1, notNullValue());
        assertThat(row1.getKey().toString(), is("13818e20-1dd2-11b2-879a-782bcb80ff6a"));
        assertThat(row1.getColumns(), notNullValue());
        assertThat(row1.getColumns().isEmpty(), is(true));
        assertThat(row1.getSuperColumns(), notNullValue());
        assertThat(row1.getSuperColumns().size(), is(3));

        SuperColumnModel actualSuperColumn0OfRow1 = row1.getSuperColumns().get(0);
        assertThat(actualSuperColumn0OfRow1, notNullValue());
        assertThat(actualSuperColumn0OfRow1.getName().toString(), is("name21"));
        assertThat(actualSuperColumn0OfRow1.getColumns(), notNullValue());
        assertThat(actualSuperColumn0OfRow1.getColumns().size(), is(2));

        ColumnModel actualColumn0OfSuperColum0OfRow1 = actualSuperColumn0OfRow1.getColumns().get(0);
        assertThat(actualColumn0OfSuperColum0OfRow1, notNullValue());
        assertThat(actualColumn0OfSuperColum0OfRow1.getName().toString(), is("211"));
        assertThat(actualColumn0OfSuperColum0OfRow1.getValue().toString(), is("value211"));

        ColumnModel actualColumn1OfSuperColum0OfRow1 = actualSuperColumn0OfRow1.getColumns().get(1);
        assertThat(actualColumn1OfSuperColum0OfRow1, notNullValue());
        assertThat(actualColumn1OfSuperColum0OfRow1.getName().toString(), is("212"));
        assertThat(actualColumn1OfSuperColum0OfRow1.getValue().toString(), is("value212"));

        SuperColumnModel actualSuperColumn1OfRow1 = row1.getSuperColumns().get(1);
        assertThat(actualSuperColumn1OfRow1.getName().toString(), is("name22"));
        assertThat(actualSuperColumn1OfRow1.getColumns(), notNullValue());
        assertThat(actualSuperColumn1OfRow1.getColumns().size(), is(2));

        ColumnModel actualColumn0OfSuperCOlumn10OfRow1 = actualSuperColumn1OfRow1.getColumns().get(0);
        assertThat(actualColumn0OfSuperCOlumn10OfRow1, notNullValue());
        assertThat(actualColumn0OfSuperCOlumn10OfRow1.getName().toString(), is("221"));
        assertThat(actualColumn0OfSuperCOlumn10OfRow1.getValue().toString(), is("value221"));

        ColumnModel actualColumn1OfSuperCOlumn10OfRow1 = actualSuperColumn1OfRow1.getColumns().get(1);
        assertThat(actualColumn1OfSuperCOlumn10OfRow1, notNullValue());
        assertThat(actualColumn1OfSuperCOlumn10OfRow1.getName().toString(), is("222"));
        assertThat(actualColumn1OfSuperCOlumn10OfRow1.getValue().toString(), is("value222"));

        SuperColumnModel actualSuperColumnModel2OfRow1 = row1.getSuperColumns().get(2);
        assertThat(actualSuperColumnModel2OfRow1.getName().toString(), is("name23"));
        assertThat(actualSuperColumnModel2OfRow1.getColumns(), notNullValue());
        assertThat(actualSuperColumnModel2OfRow1.getColumns().size(), is(1));

        ColumnModel actualColumn0OfSuperColumn2OfRow1 = actualSuperColumnModel2OfRow1.getColumns().get(0);
        assertThat(actualColumn0OfSuperColumn2OfRow1, notNullValue());
        assertThat(actualColumn0OfSuperColumn2OfRow1.getName().toString(), is("231"));
        assertThat(actualColumn0OfSuperColumn2OfRow1.getValue().toString(), is("value231"));
    }
View Full Code Here

        RowModel actualRow = actualColumnFamily.getRows().get(0);
        assertThat(actualRow, notNullValue());
        assertThat(actualRow.getColumns(), notNullValue());

        ColumnModel actualColumn = actualRow.getColumns().get(0);
        assertThat(actualColumn, notNullValue());
        assertThat(actualColumn.getValue().toString(), is("11"));
        assertThat(actualColumn.getValue().getType(), is(GenericTypeEnum.BYTES_TYPE));
    }
View Full Code Here

TOP

Related Classes of org.cassandraunit.model.ColumnModel

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.