Package org.cassandraunit.model

Examples of org.cassandraunit.model.ColumnMetadataModel


    }

    @Test
    public void shouldGetAColumnFamilyWithSecondaryIndex() {
        DataSet dataSet = new ClassPathXmlDataSet("xml/dataSetWithSecondaryIndex.xml");
        ColumnMetadataModel acutalColumnMetadataModel = dataSet.getColumnFamilies().get(0).getColumnsMetadata().get(0);
        assertThat(acutalColumnMetadataModel.getColumnName().getValue(), is("columnWithIndexAndUTF8ValidationClass"));
        assertThat(acutalColumnMetadataModel.getColumnIndexType(), is(ColumnIndexType.KEYS));
        assertThat(acutalColumnMetadataModel.getValidationClass(), is(ComparatorType.UTF8TYPE));

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

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


    }

  @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

    columnFamily3.setName("columnFamilyWithSecondaryIndex");
    columnFamily3.setType(ColumnType.STANDARD);
    columnFamily3.setKeyType(ComparatorType.UTF8TYPE);
    columnFamily3.setComparatorType(ComparatorType.UTF8TYPE);
    columnFamily3.setDefaultColumnValueType(ComparatorType.UTF8TYPE);
    columnFamily3.addColumnMetadata(new ColumnMetadataModel(
                newUtf8GenericType("columnWithSecondaryIndexAndValidationClassAsLongType"), ComparatorType.LONGTYPE, ColumnIndexType.KEYS, null));
    columnFamilies.add(columnFamily3);

        /* column family 4 with index */
        ColumnFamilyModel columnFamily4 = new ColumnFamilyModel();
        columnFamily4.setName("columnFamilyWithSecondaryIndexAndIndexName");
        columnFamily4.setType(ColumnType.STANDARD);
        columnFamily4.setKeyType(ComparatorType.UTF8TYPE);
        columnFamily4.setComparatorType(ComparatorType.UTF8TYPE);
        columnFamily4.setDefaultColumnValueType(ComparatorType.UTF8TYPE);
        columnFamily4.addColumnMetadata(new ColumnMetadataModel(
                newUtf8GenericType("columnWithSecondaryIndexAndValidationClassAsUTF8Type"), ComparatorType.UTF8TYPE, ColumnIndexType.KEYS,
                "columnWithSecondaryIndexHaveIndexNameAndValidationClassAsUTF8Type"));

        columnFamilies.add(columnFamily4);

        /* column family 5 with column validation class */
        ColumnFamilyModel columnFamily5 = new ColumnFamilyModel();
        columnFamily5.setName("columnFamilyWithColumnValidationClass");
        columnFamily5.setType(ColumnType.STANDARD);
        columnFamily5.setKeyType(ComparatorType.UTF8TYPE);
        columnFamily5.setComparatorType(ComparatorType.UTF8TYPE);
        columnFamily5.setDefaultColumnValueType(ComparatorType.UTF8TYPE);
        columnFamily5.addColumnMetadata(new ColumnMetadataModel(
                newUtf8GenericType("columnWithValidationClassAsUTF8Type"),
                ComparatorType.UTF8TYPE, null, null));

        columnFamilies.add(columnFamily5);

View Full Code Here

TOP

Related Classes of org.cassandraunit.model.ColumnMetadataModel

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.