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); }
private void mapXmlKeyspaceToModel(org.cassandraunit.dataset.xml.Keyspace xmlKeyspace) { /* keyspace */ keyspace = new KeyspaceModel(); keyspace.setName(xmlKeyspace.getName()); /* optional conf */ if (xmlKeyspace.getReplicationFactor() != null) { keyspace.setReplicationFactor(xmlKeyspace.getReplicationFactor()); } if (xmlKeyspace.getStrategy() != null) { keyspace.setStrategy(StrategyModel.fromValue(xmlKeyspace.getStrategy().value())); } mapsXmlColumnFamiliesToColumnFamiliesModel(xmlKeyspace); }