Package org.cassandraunit.dataset

Examples of org.cassandraunit.dataset.ParseException


    private KeyspaceModel keyspace = null;

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


    }

    private org.cassandraunit.dataset.xml.Keyspace getXmlKeyspace() {
        InputStream inputDataSetLocation = getInputDataSetLocation(dataSetLocation);
        if (inputDataSetLocation == null) {
            throw new ParseException("Dataset not found in classpath");
        }

        try {
            Unmarshaller unmarshaller = getUnmarshaller();
            org.cassandraunit.dataset.xml.Keyspace xmlKeyspace = (org.cassandraunit.dataset.xml.Keyspace) unmarshaller
                    .unmarshal(inputDataSetLocation);
            return xmlKeyspace;
        } catch (JAXBException e) {
            throw new ParseException(e);
        } catch (SAXException e) {
            throw new ParseException(e);
        } catch (URISyntaxException e) {
            throw new ParseException(e);
        }

    }
View Full Code Here

            /* composite type */
            try {
                columnModel.setName(new GenericType(StringUtils.split(xmlColumn.getName(), ":"),
                        typesBelongingCompositeTypeForComparatorType));
            } catch (IllegalArgumentException e) {
                throw new ParseException(xmlColumn.getName()
                        + " doesn't fit with the schema declaration of your composite type");
            }
        } else {
            /* simple type */
            columnModel.setName(new GenericType(xmlColumn.getName(), GenericTypeEnum.fromValue(comparatorType
                    .getTypeName())));
        }

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

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

        } else if (ComparatorType.COMPOSITETYPE.getTypeName().equals(type.getTypeName())) {
            /* composite type */
            try {
                key = new GenericType(StringUtils.split(rowKeyOrColumnName, ":"), typesBelongingCompositeType);
            } catch (IllegalArgumentException e) {
                throw new ParseException(rowKeyOrColumnName
                        + " doesn't fit with the schema declaration of your composite type");
            }
        } else {
            /* simple type */
            key = new GenericType(rowKeyOrColumnName, GenericTypeEnum.fromValue(type.getTypeName()));
View Full Code Here

  private static ComparatorType parseCompositeComparatorType(String comparatorType) {
    String compositeType = removePrependingCompositeType(comparatorType);

    if (!hasParenthesisForComponentTypes(compositeType)) {
      throw new ParseException("[" + comparatorType + "] must contain types wrapped within parenthesis, like: CompositeType(<type>,...,<type>).");
    }

    String[] types = extractComponentTypes(compositeType);

    if (areTypesNullOrEmpty(types)) {
      throw new ParseException("[" + comparatorType + "] must contain non-empty types, like: CompositeType(<type>,...,<type>).");
    }

    for (String type : types) {
      parseComponentType(comparatorType, type);
    }
View Full Code Here

      // Component types may take values like "IntegerType" or
      // "TimeUUID(reversed=true)" or even "LongType(reversed=false)".
      String cleanType = removeReversedQualifierIfPresent(type);
      ParsedDataType.valueOf(cleanType);
    } catch (IllegalArgumentException e) {
      throw new ParseException("[" + comparatorType + "] contains an invalid 'component' type: [" + type + "].");
    }
  }
View Full Code Here

      // "TimeUUID(reversed=true)" or even "LongType(reversed=false)".
      String cleanType = removeReversedQualifierIfPresent(type);
      ParsedDataType.valueOf(cleanType);
      return ComparatorType.getByClassName(cleanType);
    } catch (IllegalArgumentException e) {
      throw new ParseException("ComparatorType [" + type + "] is invalid.");
    }
  }
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.