Package org.cassandraunit.dataset

Examples of org.cassandraunit.dataset.DataSet


        dataSet.getKeyspace();
    }

    @Test
    public void shouldGetAColumnFamilyWithNullColumnValue() {
        DataSet dataSet = new ClassPathJsonDataSet("json/dataSetWithNullColumnValue.json");
        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.getValue(), nullValue());
    }

    @Test
    public void shouldGetAColumnFamilyWithMetadataAndFunction() {
        DataSet dataSet = new ClassPathJsonDataSet("json/dataSetWithMetadataAndFunctions.json");
        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

        assertThat(columns.get(5).getValue().getValue(), is("v1"));
    }

    @Test
    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"));
View Full Code Here

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

    @Test
    public void shouldUseComparatorTypeForMetadataColumnName() {
        DataSet dataSet = new ClassPathJsonDataSet("json/dataSetWithComparatorType.json");
        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 ClassPathJsonDataSet("json/dataSetWithReversedComparatorOnSimpleType.json");

        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(column3.getValue().getValue(), is("a"));
    }

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

        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

        assertThat(columns.get(5).getValue().getValue(), is("v1"));
    }

    @Test
    public void shouldGetBinaryData() {
        DataSet dataSet = new ClassPathJsonDataSet("json/dataSetWithBinaryData.json");
        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"));
View Full Code Here

  }

  @Test
  public void shouldGetAJsonDataSetStructure() throws Exception {

    DataSet dataSet = new FileJsonDataSet(super.targetDataSetPathFileName);
    assertThat(dataSet, notNullValue());
    assertThat(dataSet.getKeyspace(), notNullValue());
    assertThat(dataSet.getKeyspace().getName(), is("beautifulKeyspaceName"));
    assertThat(dataSet.getKeyspace().getReplicationFactor(), is(1));
    assertThat(dataSet.getKeyspace().getStrategy(), is(StrategyModel.SIMPLE_STRATEGY));

    assertThat(dataSet.getColumnFamilies(), notNullValue());
    assertThat(dataSet.getColumnFamilies().size(), is(1));
    assertThat(dataSet.getColumnFamilies().get(0), notNullValue());
    assertThat(dataSet.getColumnFamilies().get(0).getName(), is("columnFamily1"));
    assertThat(dataSet.getColumnFamilies().get(0).getType(), is(ColumnType.STANDARD));
    assertThat(dataSet.getColumnFamilies().get(0).getKeyType().getTypeName(),
        is(ComparatorType.BYTESTYPE.getTypeName()));
    assertThat(dataSet.getColumnFamilies().get(0).getComparatorType().getTypeName(),
        is(ComparatorType.BYTESTYPE.getTypeName()));
    assertThat(dataSet.getColumnFamilies().get(0).getSubComparatorType(), nullValue());
  }
View Full Code Here

    assertThat(dataSet.getColumnFamilies().get(0).getSubComparatorType(), nullValue());
  }

  @Test(expected = ParseException.class)
  public void shouldNotGetAJsonDataSetStructureBecauseOfNull() {
    DataSet dataSet = new FileJsonDataSet(null);
    dataSet.getKeyspace();
  }
View Full Code Here

    dataSet.getKeyspace();
  }

  @Test(expected = ParseException.class)
  public void shouldNotGetAJsonDataSetStructureBecauseOfFileNotFound() {
    DataSet dataSet = new FileJsonDataSet("/notfound.json");
    dataSet.getKeyspace();
  }
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.