Package org.cassandraunit.dataset

Examples of org.cassandraunit.dataset.DataSet


        dataSet.getKeyspace();
    }

    @Test
    public void shouldGetAColumnFamilyWithNullColumnValue() {
        DataSet dataSet = new ClassPathXmlDataSet("xml/dataSetWithNullColumnValue.xml");
        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


        assertThat(columnModel.getName().getValue(), is("columnWithNullColumnValue"));
        assertThat(columnModel.getValue(), nullValue());
    }
    @Test
    public void shouldGetAColumnFamilyWithTimestampedColumn() {
        DataSet dataSet = new ClassPathXmlDataSet("xml/dataSetWithTimestamp.xml");
        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

        assertThat(actualColumn.getValue().getType(), is(GenericTypeEnum.COUNTER_TYPE));
    }

    @Test(expected = ParseException.class)
    public void shouldNotGetCounterColumnFamilyBecauseThereIsFunctionOverridingDefaultValueType() {
        DataSet dataSet = new ClassPathJsonDataSet("json/dataSetBadCounterColumnFamilyWithFunction.json");
        dataSet.getKeyspace();
    }
View Full Code Here

        assertThat(columnModel.getTimestamp(), is(2020L));
    }

    @Test
    public void shouldGetAColumnFamilyWithMetadataAndFunction() {
        DataSet dataSet = new ClassPathXmlDataSet("xml/dataSetWithMetadataAndFunctions.xml");
        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"));
View Full Code Here

        dataSet.getKeyspace();
    }

    @Test
    public void shouldGetAColumnFamilyWithSecondaryIndex() {
        DataSet dataSet = new ClassPathJsonDataSet("json/dataSetWithSecondaryIndex.json");

        ColumnMetadataModel actualColumnMetadataModel1 = dataSet.getColumnFamilies().get(0).getColumnsMetadata().get(0);
        assertThat(actualColumnMetadataModel1.getColumnName().getValue(), is("columnWithIndexAndUTF8ValidationClass"));
        assertThat(actualColumnMetadataModel1.getColumnIndexType(), is(ColumnIndexType.KEYS));
        assertThat(actualColumnMetadataModel1.getValidationClass(), is(ComparatorType.UTF8TYPE));

        ColumnMetadataModel actualColumnMetadataModel2 = dataSet.getColumnFamilies().get(0).getColumnsMetadata().get(1);
        assertThat(actualColumnMetadataModel2.getColumnName().getValue(), is("columnWithIndexAndIndexNameAndUTF8ValidationClass"));
        assertThat(actualColumnMetadataModel2.getColumnIndexType(), is(ColumnIndexType.KEYS));
        assertThat(actualColumnMetadataModel2.getValidationClass(), is(ComparatorType.UTF8TYPE));
        assertThat(actualColumnMetadataModel2.getIndexName(), is("indexNameOfTheIndex"));

        ColumnMetadataModel actualColumnMetadataModel3 = dataSet.getColumnFamilies().get(0).getColumnsMetadata().get(2);
        assertThat(actualColumnMetadataModel3.getColumnName().getValue(), is("columnWithUTF8ValidationClass"));
        assertThat(actualColumnMetadataModel3.getColumnIndexType(), nullValue());
        assertThat(actualColumnMetadataModel3.getValidationClass(), is(ComparatorType.UTF8TYPE));
    }
View Full Code Here

        assertThat(column3.getValue().getType(),is(GenericTypeEnum.UTF_8_TYPE));
    }

  @Test
    public void shouldUseComparatorTypeForMetadataColumnName() {
        DataSet dataSet = new ClassPathXmlDataSet("xml/dataSetWithComparatorType.xml");
        ColumnMetadataModel columnMetadata = dataSet.getColumnFamilies().get(0).getColumnsMetadata().get(0);
        assertThat(columnMetadata.getColumnName().getType(), is(GenericTypeEnum.TIME_UUID_TYPE));
    }
View Full Code Here

        assertThat(columnMetadata.getColumnName().getType(), is(GenericTypeEnum.TIME_UUID_TYPE));
    }

    @Test
    public void shouldGetAColumnFamilyWithColumnsInReverseOrder() {
        DataSet dataSet = new ClassPathXmlDataSet("xml/dataSetWithReversedComparatorOnSimpleType.xml");

        ColumnFamilyModel columnFamilyModel = dataSet.getColumnFamilies().get(0);
        assertThat(columnFamilyModel.getName(), is("columnFamilyWithReversedComparatorOnSimpleType"));
        assertThat(columnFamilyModel.getComparatorType().getTypeName(), is(ComparatorType.UTF8TYPE.getTypeName()));
        assertThat(columnFamilyModel.getComparatorTypeAlias(), is("(reversed=true)"));

        List<ColumnModel> columns = columnFamilyModel.getRows().get(0).getColumns();
View Full Code Here

        assertThat(actualColumnMetadataModel3.getValidationClass(), is(ComparatorType.UTF8TYPE));
    }

    @Test
    public void shouldGetAColumnFamilyWithCompositeType() throws Exception {
        DataSet dataSet = new ClassPathJsonDataSet("json/dataSetWithCompositeType.json");
        assertThatKeyspaceModelWithCompositeTypeIsOk(dataSet);
    }
View Full Code Here

        assertThatKeyspaceModelWithCompositeTypeIsOk(dataSet);
    }

    @Test(expected = ParseException.class)
    public void shouldNotGetAColumnFamilyWithCompositeType() throws Exception {
        DataSet dataSet = new ClassPathJsonDataSet("json/dataSetWithBadCompositeType.json");
        dataSet.getKeyspace();
    }
View Full Code Here

        assertThat(column3.getValue().getValue(), is("a"));
    }

    @Test
    public void shouldGetAColumnFamilyWithCompositeColumnsInReverseOrder() {
        DataSet dataSet = new ClassPathXmlDataSet("xml/dataSetWithReversedComparatorOnCompositeTypes.xml");

        ColumnFamilyModel columnFamilyModel = dataSet.getColumnFamilies().get(0);
        assertThat(columnFamilyModel.getName(), is("columnFamilyWithReversedComparatorOnCompositeTypes"));
        assertThat(columnFamilyModel.getComparatorType().getTypeName(), is(ComparatorType.COMPOSITETYPE.getTypeName()));
        assertThat(columnFamilyModel.getComparatorTypeAlias(), is("(LongType(reversed=true),UTF8Type,IntegerType(reversed=true))"));

        GenericTypeEnum[] expecTedTypesBelongingCompositeType = new GenericTypeEnum[] { GenericTypeEnum.LONG_TYPE, GenericTypeEnum.UTF_8_TYPE,
View Full Code Here

TOP

Related Classes of org.cassandraunit.dataset.DataSet

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.