Package org.cassandraunit.model

Examples of org.cassandraunit.model.ColumnModel


        assertThat(columnFamilyModel.getComparatorType().getTypeName(), is(ComparatorType.UTF8TYPE.getTypeName()));
        assertThat(columnFamilyModel.getComparatorTypeAlias(), is("(reversed=true)"));

        List<ColumnModel> columns = columnFamilyModel.getRows().get(0).getColumns();

        ColumnModel column1 = columns.get(0);
        assertThat(column1.getName().getValue(), is("c"));
        assertThat(column1.getValue().getValue(), is("c"));

        ColumnModel column2 = columns.get(1);
        assertThat(column2.getName().getValue(), is("b"));
        assertThat(column2.getValue().getValue(), is("b"));

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


    /* row 1 */
    RowModel row1 = new RowModel();
    row1.setKey(new GenericType("10", GenericTypeEnum.LONG_TYPE));
    List<ColumnModel> columns1 = new ArrayList<ColumnModel>();
    ColumnModel columnModel11 = new ColumnModel();
    columnModel11.setName(new GenericType("counter11", GenericTypeEnum.UTF_8_TYPE));
    columnModel11.setValue(new GenericType("11", GenericTypeEnum.COUNTER_TYPE));
    columns1.add(columnModel11);
    ColumnModel columnModel12 = new ColumnModel();
    columnModel12.setName(new GenericType("counter12", GenericTypeEnum.UTF_8_TYPE));
    columnModel12.setValue(new GenericType("12", GenericTypeEnum.COUNTER_TYPE));
    columns1.add(columnModel12);
    row1.setColumns(columns1);
    rows.add(row1);

    columnFamily.setRows(rows);
View Full Code Here

    public void shouldGetBinaryData() {
        DataSet dataSet = new ClassPathXmlDataSet("xml/dataSetWithBinaryData.xml");
        ColumnFamilyModel columnFamilyModel = dataSet.getColumnFamilies().get(0);
        assertThat(columnFamilyModel.getName(), is("columnFamilyWithBinaryData"));
        List<ColumnModel> columns = columnFamilyModel.getRows().get(0).getColumns();
        ColumnModel column1 = columns.get(0);
        assertThat(column1.getName().getValue(), is("a"));
        assertThat(column1.getValue().getValue(), is("aGVsbG8gd29ybGQh"));
        assertThat(column1.getValue().getType(), is(GenericTypeEnum.BYTES_TYPE));
    }
View Full Code Here

    /* row 1 */
    RowModel row1 = new RowModel();
    row1.setKey(new GenericType("01", GenericTypeEnum.BYTES_TYPE));
    List<ColumnModel> columns1 = new ArrayList<ColumnModel>();
    ColumnModel columnModel11 = new ColumnModel();
    columnModel11.setName(new GenericType("01", GenericTypeEnum.BYTES_TYPE));
    columnModel11.setValue(new GenericType("1", GenericTypeEnum.LONG_TYPE));
    columns1.add(columnModel11);
    ColumnModel columnModel12 = new ColumnModel();
    columnModel12.setName(new GenericType("02", GenericTypeEnum.BYTES_TYPE));
    columnModel12.setValue(new GenericType("19652258", GenericTypeEnum.LONG_TYPE));
    columns1.add(columnModel12);
    row1.setColumns(columns1);
    rows.add(row1);

    columnFamily.setRows(rows);
View Full Code Here

    /* row 1 */
    RowModel row1 = new RowModel();
    row1.setKey(new GenericType("01", GenericTypeEnum.BYTES_TYPE));
    List<ColumnModel> columns1 = new ArrayList<ColumnModel>();
    ColumnModel columnModel11 = new ColumnModel();
    columnModel11.setName(new GenericType("01", GenericTypeEnum.BYTES_TYPE));
    columnModel11.setValue(new GenericType("1", GenericTypeEnum.LONG_TYPE));
    columns1.add(columnModel11);
    ColumnModel columnModel12 = new ColumnModel();
    columnModel12.setName(new GenericType("02", GenericTypeEnum.BYTES_TYPE));
    columnModel12.setValue(new GenericType("19652258", GenericTypeEnum.LONG_TYPE));
    columns1.add(columnModel12);
    row1.setColumns(columns1);
    rows.add(row1);

    columnFamily.setRows(rows);
View Full Code Here

    /* row 1 */
    RowModel row1 = new RowModel();
    row1.setKey(new GenericType("13816710-1dd2-11b2-879a-782bcb80ff6a", GenericTypeEnum.UUID_TYPE));
    List<ColumnModel> columns1 = new ArrayList<ColumnModel>();
    ColumnModel columnModel11 = new ColumnModel();
    columnModel11
        .setName(new GenericType("13816710-1dd2-11b2-879a-782bcb80ff6a", GenericTypeEnum.LEXICAL_UUID_TYPE));
    columnModel11.setValue(new GenericType("11", GenericTypeEnum.BYTES_TYPE));
    columns1.add(columnModel11);
    ColumnModel columnModel12 = new ColumnModel();
    columnModel12
        .setName(new GenericType("13818e20-1dd2-11b2-879a-782bcb80ff6a", GenericTypeEnum.LEXICAL_UUID_TYPE));
    columnModel12.setValue(new GenericType("12", GenericTypeEnum.BYTES_TYPE));
    columns1.add(columnModel12);
    row1.setColumns(columns1);
    rows.add(row1);

    columnFamily.setRows(rows);
View Full Code Here

    /* row 1 */
    RowModel row1 = new RowModel();
    row1.setKey(new GenericType("10", GenericTypeEnum.LONG_TYPE));
    List<ColumnModel> columns1 = new ArrayList<ColumnModel>();
    ColumnModel columnModel11 = new ColumnModel();
    columnModel11.setName(new GenericType("11", GenericTypeEnum.INTEGER_TYPE));
    columnModel11.setValue(new GenericType("11", GenericTypeEnum.BYTES_TYPE));
    columns1.add(columnModel11);
    ColumnModel columnModel12 = new ColumnModel();
    columnModel12.setName(new GenericType("12", GenericTypeEnum.INTEGER_TYPE));
    columnModel12.setValue(new GenericType("12", GenericTypeEnum.BYTES_TYPE));
    columns1.add(columnModel12);
    row1.setColumns(columns1);
    rows.add(row1);

    columnFamily.setRows(rows);
View Full Code Here

    /* row 1 */
    RowModel row1 = new RowModel();
    row1.setKey(new GenericType("13816710-1dd2-11b2-879a-782bcb80ff6a", GenericTypeEnum.TIME_UUID_TYPE));
    List<ColumnModel> columns1 = new ArrayList<ColumnModel>();
    ColumnModel columnModel11 = new ColumnModel();
    columnModel11.setName(new GenericType("name11", GenericTypeEnum.UTF_8_TYPE));
    columnModel11.setValue(new GenericType("11", GenericTypeEnum.BYTES_TYPE));
    columns1.add(columnModel11);
    ColumnModel columnModel12 = new ColumnModel();
    columnModel12.setName(new GenericType("name12", GenericTypeEnum.UTF_8_TYPE));
    columnModel12.setValue(new GenericType("12", GenericTypeEnum.BYTES_TYPE));
    columns1.add(columnModel12);
    row1.setColumns(columns1);
    rows.add(row1);

    /* row 2 */
    RowModel row2 = new RowModel();
    row2.setKey(new GenericType("13818e20-1dd2-11b2-879a-782bcb80ff6a", GenericTypeEnum.TIME_UUID_TYPE));
    List<ColumnModel> columns2 = new ArrayList<ColumnModel>();
    ColumnModel columnModel21 = new ColumnModel();
    columnModel21.setName(new GenericType("name21", GenericTypeEnum.UTF_8_TYPE));
    columnModel21.setValue(new GenericType("21", GenericTypeEnum.BYTES_TYPE));
    columns2.add(columnModel21);
    ColumnModel columnModel22 = new ColumnModel();
    columnModel22.setName(new GenericType("name22", GenericTypeEnum.UTF_8_TYPE));
    columnModel22.setValue(new GenericType("22", GenericTypeEnum.BYTES_TYPE));
    columns2.add(columnModel22);
    row2.setColumns(columns2);
    rows.add(row2);

    columnFamily.setRows(rows);
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(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);
View Full Code Here

        assertThat(columnFamilyModel.getComparatorType().getTypeName(), is(ComparatorType.UTF8TYPE.getTypeName()));
        assertThat(columnFamilyModel.getComparatorTypeAlias(), is("(reversed=true)"));

        List<ColumnModel> columns = columnFamilyModel.getRows().get(0).getColumns();

        ColumnModel column1 = columns.get(0);
        assertThat(column1.getName().getValue(), is("c"));
        assertThat(column1.getValue().getValue(), is("c"));

        ColumnModel column2 = columns.get(1);
        assertThat(column2.getName().getValue(), is("b"));
        assertThat(column2.getValue().getValue(), is("b"));

        ColumnModel column3 = columns.get(2);
        assertThat(column3.getName().getValue(), is("a"));
        assertThat(column3.getValue().getValue(), is("a"));
    }
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.