Package org.cassandraunit.dataset

Examples of org.cassandraunit.dataset.ParseException


        this(dataSetLocation, true, true, keyspaceName);
    }

    public AbstractCQLDataSet(String dataSetLocation, boolean keyspaceCreation, boolean keyspaceDeletion, String keyspaceName) {
        if (getInputDataSetLocation(dataSetLocation) == null) {
            throw new ParseException("Dataset not found");
        }
        this.dataSetLocation = dataSetLocation;
        this.keyspaceCreation = keyspaceCreation;
        this.keyspaceDeletion = keyspaceDeletion;
        if (keyspaceName != null) {
View Full Code Here


                }
            }
            br.close();
            return cqlQueries;
        } catch (IOException e) {
            throw new ParseException(e);
        }
    }
View Full Code Here

        return keyspace.getColumnFamilies();
    }

    protected void mapParsedKeyspaceToModel(ParsedKeyspace parsedKeyspace) {
        if (parsedKeyspace == null) {
            throw new ParseException("dataSet is empty");
        }
        /* keyspace */
        keyspace = new KeyspaceModel();
        if (parsedKeyspace.getName() == null) {
            throw new ParseException("Keyspace name is mandatory");
        }
        keyspace.setName(parsedKeyspace.getName());

        /* optional conf */
        if (parsedKeyspace.getReplicationFactor() != 0) {
            keyspace.setReplicationFactor(parsedKeyspace.getReplicationFactor());
        }

        if (parsedKeyspace.getStrategy() != null) {
            try {
                keyspace.setStrategy(StrategyModel.fromValue(parsedKeyspace.getStrategy()));
            } catch (IllegalArgumentException e) {
                throw new ParseException("Invalid keyspace Strategy");
            }
        }

        mapsParsedColumnFamiliesToColumnFamiliesModel(parsedKeyspace);

View Full Code Here

        ColumnFamilyModel columnFamily = new ColumnFamilyModel();

        /* structure information */
        if (parsedColumnFamily == null || parsedColumnFamily.getName() == null) {
            throw new ParseException("Column Family Name is missing");
        }
        columnFamily.setName(parsedColumnFamily.getName());
        if (parsedColumnFamily.getType() != null) {
            columnFamily.setType(ColumnType.valueOf(parsedColumnFamily.getType().toString()));
        }
View Full Code Here

    private ColumnMetadataModel mapParsedColumMetadataToColumnMetadata(ParsedColumnMetadata parsedColumnMetadata,
                                                                       ComparatorType comparatorType,
                                                                       GenericTypeEnum[] typesBelongingCompositeTypeForComparatorType) {
        if (parsedColumnMetadata.getName() == null) {
            throw new ParseException("column metadata name can't be empty");
        }

        if (parsedColumnMetadata.getValidationClass() == null) {
            throw new ParseException("column metadata validation class can't be empty");
        }

        ColumnMetadataModel columnMetadata = new ColumnMetadataModel();
        columnMetadata.setColumnName(TypeExtractor.constructGenericType(parsedColumnMetadata.getName(), comparatorType,
                typesBelongingCompositeTypeForComparatorType));
View Full Code Here

        columnModel.setName(TypeExtractor.constructGenericType(parsedColumn.getName(), comparatorType,
                typesBelongingCompositeTypeForComparatorType));

        if (ComparatorType.COUNTERTYPE.getClassName().equals(defaultColumnValueType.getClassName())
                && TypeExtractor.containFunctions(parsedColumn.getValue())) {
            throw new ParseException("Impossible to override Column value into a Counter column family");
        }

        GenericType columnValue = null;
        if (parsedColumn.getValue() != null) {
            if (metaData != null && !TypeExtractor.containFunctions(parsedColumn.getValue())) {
View Full Code Here

    private String dataSetLocation = null;

    public AbstractYamlDataSet(String dataSetLocation) {
        this.dataSetLocation = dataSetLocation;
        if (getInputDataSetLocation(dataSetLocation) == null) {
            throw new ParseException("Dataset not found");
        }
    }
View Full Code Here

    @Override
    protected ParsedKeyspace getParsedKeyspace() {
        InputStream inputDataSetLocation = getInputDataSetLocation(dataSetLocation);
        if (inputDataSetLocation == null) {
            throw new ParseException("Dataset not found in classpath");
        }

        Yaml yaml = new Yaml();
        try {
            ParsedKeyspace keyspace = yaml.loadAs(inputDataSetLocation, ParsedKeyspace.class);
            return keyspace;
        } catch (YAMLException e) {
            throw new ParseException(e);
        }
    }
View Full Code Here

    protected String dataSetLocation = null;

    public AbstractJsonDataSet(String dataSetLocation) {
        this.dataSetLocation = dataSetLocation;
        if (getInputDataSetLocation(dataSetLocation) == null) {
            throw new ParseException("Dataset not found");
        }
    }
View Full Code Here

    }

    protected ParsedKeyspace getParsedKeyspace() {
        InputStream inputDataSetLocation = getInputDataSetLocation(dataSetLocation);
        if (inputDataSetLocation == null) {
            throw new ParseException("Dataset not found");
        }

        ObjectMapper jsonMapper = new ObjectMapper();
        try {
            return jsonMapper.readValue(inputDataSetLocation, ParsedKeyspace.class);
        } catch (JsonParseException e) {
            throw new ParseException(e);
        } catch (JsonMappingException e) {
            throw new ParseException(e);
        } catch (IOException e) {
            throw new ParseException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.cassandraunit.dataset.ParseException

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.