Package org.cassandraunit.model

Examples of org.cassandraunit.model.RowModel


    @Test
    public void shouldGetOneSuperColumnFamilyData() {
        DataSet dataSet = new ClassPathXmlDataSet("xml/dataSetDefinedValues.xml");
        assertThat(dataSet.getColumnFamilies().get(0).getRows(), notNullValue());
        assertThat(dataSet.getColumnFamilies().get(0).getRows().size(), is(2));
        RowModel actualrow0 = dataSet.getColumnFamilies().get(0).getRows().get(0);
        assertThat(actualrow0, notNullValue());
        assertThat(actualrow0.getKey().toString(), is("13816710-1dd2-11b2-879a-782bcb80ff6a"));
        assertThat(actualrow0.getColumns(), notNullValue());
        assertThat(actualrow0.getColumns().isEmpty(), is(true));
        assertThat(actualrow0.getSuperColumns(), notNullValue());
        assertThat(actualrow0.getSuperColumns().size(), is(2));

        SuperColumnModel actualSuperColumn = actualrow0.getSuperColumns().get(0);
        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);
View Full Code Here


        ColumnFamilyModel actualColumnFamily = dataSet.getColumnFamilies().get(0);
        assertThat(actualColumnFamily, notNullValue());
        assertThat(actualColumnFamily.getName(), is("beautifulColumnFamilyName"));
        assertThat(actualColumnFamily.getRows(), notNullValue());

        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

        DataSet dataSet = new ClassPathXmlDataSet("xml/dataSetColumnValueTest.xml");
        ColumnFamilyModel actualColumnFamily = dataSet.getColumnFamilies().get(1);
        assertThat(actualColumnFamily, notNullValue());
        assertThat(actualColumnFamily.getName(), is("beautifulColumnFamilyName2"));
        assertThat(actualColumnFamily.getRows(), notNullValue());
        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.UTF_8_TYPE));
    }
View Full Code Here

        ColumnFamilyModel actualColumnFamily = dataSet.getColumnFamilies().get(2);
        assertThat(actualColumnFamily, notNullValue());
        assertThat(actualColumnFamily.getName(), is("beautifulColumnFamilyName3"));
        assertThat(actualColumnFamily.getRows(), notNullValue());

        RowModel actualRowOfColumnFamily = actualColumnFamily.getRows().get(0);
        assertThat(actualRowOfColumnFamily, notNullValue());
        assertThat(actualRowOfColumnFamily.getColumns(), notNullValue());
        ColumnModel actualColumn0OfColumnFamily = actualRowOfColumnFamily.getColumns().get(0);
        assertThat(actualColumn0OfColumnFamily, notNullValue());
        assertThat(actualColumn0OfColumnFamily.getValue().toString(), is("1"));
        assertThat(actualColumn0OfColumnFamily.getValue().getType(), is(GenericTypeEnum.LONG_TYPE));

        ColumnModel actualColumn1OfColumnFamily = actualRowOfColumnFamily.getColumns().get(1);
        assertThat(actualColumn1OfColumnFamily, notNullValue());
        assertThat(actualColumn1OfColumnFamily.getValue().toString(), is("value12"));
        assertThat(actualColumn1OfColumnFamily.getValue().getType(), is(GenericTypeEnum.UTF_8_TYPE));
    }
View Full Code Here

        assertThat(actualColumnFamilyModel2.getComparatorType().getClassName(), is(ComparatorType.UTF8TYPE.getClassName()));
        assertThat(actualColumnFamilyModel2.getDefaultColumnValueType().getClassName(), is(ComparatorType.COUNTERTYPE.getClassName()));
        assertThat(actualColumnFamilyModel2.getRows(), notNullValue());
        assertThat(actualColumnFamilyModel2.getRows().size(), is(1));

        RowModel actualRowOfColumnFamily2 = actualColumnFamilyModel2.getRows().get(0);
        assertThat(actualRowOfColumnFamily2, notNullValue());
        assertThat(actualRowOfColumnFamily2.getColumns(), notNullValue());
        assertThat(actualRowOfColumnFamily2.getColumns().size(), is(2));

        ColumnModel actualColumn0OfRowOfColumnFamily2 = actualRowOfColumnFamily2.getColumns().get(0);
        assertThat(actualColumn0OfRowOfColumnFamily2, notNullValue());
        assertThat(actualColumn0OfRowOfColumnFamily2.getName().getValue(), is("counter11"));
        assertThat(actualColumn0OfRowOfColumnFamily2.getValue().getValue(), is("11"));
        assertThat(actualColumn0OfRowOfColumnFamily2.getValue().getType(), is(GenericTypeEnum.COUNTER_TYPE));

        ColumnModel actualColumn1OfRowOfColumnFamily2 = actualRowOfColumnFamily2.getColumns().get(1);
        assertThat(actualColumn1OfRowOfColumnFamily2, notNullValue());
        assertThat(actualColumn1OfRowOfColumnFamily2.getName().getValue(), is("counter12"));
        assertThat(actualColumn1OfRowOfColumnFamily2.getValue().getValue(), is("12"));
        assertThat(actualColumn1OfRowOfColumnFamily2.getValue().getType(), is(GenericTypeEnum.COUNTER_TYPE));
    }
View Full Code Here

    columnFamily.setComparatorType(ComparatorType.COMPOSITETYPE);
    columnFamily.setComparatorTypeAlias("(LongType,UTF8Type,IntegerType)");
    columnFamily.setDefaultColumnValueType(ComparatorType.UTF8TYPE);

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

    /* column1 */
    ColumnModel column1 = new ColumnModel();
    column1.setName(new GenericType(new String[] { "11", "aa", "11" }, new GenericTypeEnum[] {
        GenericTypeEnum.LONG_TYPE, GenericTypeEnum.UTF_8_TYPE, GenericTypeEnum.INTEGER_TYPE }));
    column1.setValue(new GenericType("v1", GenericTypeEnum.UTF_8_TYPE));
    row.getColumns().add(column1);

    /* column2 */
    ColumnModel column2 = new ColumnModel();
    column2.setName(new GenericType(new String[] { "11", "ab", "11" }, new GenericTypeEnum[] {
        GenericTypeEnum.LONG_TYPE, GenericTypeEnum.UTF_8_TYPE, GenericTypeEnum.INTEGER_TYPE }));
    column2.setValue(new GenericType("v2", GenericTypeEnum.UTF_8_TYPE));
    row.getColumns().add(column2);

    /* column3 */
    ColumnModel column3 = new ColumnModel();
    column3.setName(new GenericType(new String[] { "11", "ab", "12" }, new GenericTypeEnum[] {
        GenericTypeEnum.LONG_TYPE, GenericTypeEnum.UTF_8_TYPE, GenericTypeEnum.INTEGER_TYPE }));
    column3.setValue(new GenericType("v3", GenericTypeEnum.UTF_8_TYPE));
    row.getColumns().add(column3);

    /* column4 */
    ColumnModel column4 = new ColumnModel();
    column4.setName(new GenericType(new String[] { "12", "aa", "11" }, new GenericTypeEnum[] {
        GenericTypeEnum.LONG_TYPE, GenericTypeEnum.UTF_8_TYPE, GenericTypeEnum.INTEGER_TYPE }));
    column4.setValue(new GenericType("v4", GenericTypeEnum.UTF_8_TYPE));
    row.getColumns().add(column4);

    /* column5 */
    ColumnModel column5 = new ColumnModel();
    column5.setName(new GenericType(new String[] { "12", "ab", "11" }, new GenericTypeEnum[] {
        GenericTypeEnum.LONG_TYPE, GenericTypeEnum.UTF_8_TYPE, GenericTypeEnum.INTEGER_TYPE }));
    column5.setValue(new GenericType("v5", GenericTypeEnum.UTF_8_TYPE));
    row.getColumns().add(column5);

    /* column6 */
    ColumnModel column6 = new ColumnModel();
    column6.setName(new GenericType(new String[] { "12", "zz", "12" }, new GenericTypeEnum[] {
        GenericTypeEnum.LONG_TYPE, GenericTypeEnum.UTF_8_TYPE, GenericTypeEnum.INTEGER_TYPE }));
    column6.setValue(new GenericType("v6", GenericTypeEnum.UTF_8_TYPE));
    row.getColumns().add(column6);

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

    /* column family 2 with composite Type row key */
    ColumnFamilyModel columnFamily2 = new ColumnFamilyModel();
    columnFamily2.setName("columnFamilyWithRowKeyCompositeType");
    columnFamily2.setKeyType(ComparatorType.COMPOSITETYPE);
    columnFamily2.setKeyTypeAlias("(LongType,UTF8Type)");
    columnFamily2.setComparatorType(ComparatorType.UTF8TYPE);
    columnFamily2.setDefaultColumnValueType(ComparatorType.UTF8TYPE);

    /* row1 */
    RowModel row21 = new RowModel();
    row21.setKey(new GenericType(new String[] { "12", "az" }, new GenericTypeEnum[] { GenericTypeEnum.LONG_TYPE,
        GenericTypeEnum.UTF_8_TYPE }));

    /* column1 */
    ColumnModel column21 = new ColumnModel();
    column21.setName(new GenericType("a", GenericTypeEnum.UTF_8_TYPE));
    column21.setValue(new GenericType("a", GenericTypeEnum.UTF_8_TYPE));
    row21.getColumns().add(column21);
    columnFamily2.getRows().add(row21);

    keyspace.getColumnFamilies().add(columnFamily2);
    when(mockDataSet.getKeyspace()).thenReturn(keyspace);
    when(mockDataSet.getColumnFamilies()).thenReturn(keyspace.getColumnFamilies());
View Full Code Here

        columnFamily.setName("columnFamilyWithNullColumnValue");
        columnFamily.setKeyType(ComparatorType.UTF8TYPE);
        columnFamily.setDefaultColumnValueType(ComparatorType.UTF8TYPE);

        /* 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);

        when(mockDataSet.getKeyspace()).thenReturn(keyspace);
View Full Code Here

        columnFamily.setName("columnFamilyWithTimestampedColumn");
        columnFamily.setKeyType(ComparatorType.UTF8TYPE);
        columnFamily.setDefaultColumnValueType(ComparatorType.UTF8TYPE);

        /* 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);

        when(mockDataSet.getKeyspace()).thenReturn(keyspace);
View Full Code Here

        columnFamily.setComparatorType(ComparatorType.UTF8TYPE);
        columnFamily.setComparatorTypeAlias("(reversed=true)");
        columnFamily.setDefaultColumnValueType(ComparatorType.BYTESTYPE);

    /* 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);
        when(mockDataSet.getColumnFamilies()).thenReturn(keyspace.getColumnFamilies());
View Full Code Here

        columnFamily.setComparatorType(ComparatorType.COMPOSITETYPE);
        columnFamily.setComparatorTypeAlias("(LongType(reversed=true),UTF8Type,IntegerType(reversed=true))");
        columnFamily.setDefaultColumnValueType(ComparatorType.BYTESTYPE);

    /* row1 */
        RowModel row1 = new RowModel();
        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);
        when(mockDataSet.getColumnFamilies()).thenReturn(keyspace.getColumnFamilies());
View Full Code Here

TOP

Related Classes of org.cassandraunit.model.RowModel

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.