}
private void createSchema(JsonNode configNode) throws IOException, RepositoryException, ImportConflictException,
ImportException, JsonFormatException, NoServersException, InterruptedException, KeeperException {
JsonImport jsonImport = new JsonImport(table, repository, new DefaultImportListener());
// Namespaces
ObjectNode namespacesNode = JsonUtil.getObject(configNode, "namespaces", null);
if (namespacesNode != null) {
jsonImport.readNamespaces(namespacesNode);
}
// Fields
JsonNode fieldTypesNode = configNode.get("fieldTypes");
if (fieldTypesNode != null && fieldTypesNode.isArray()) {
for (JsonNode fieldTypeNode : fieldTypesNode) {
FieldType importFieldType = jsonImport.importFieldType(fieldTypeNode);
JsonNode propertiesNode = fieldTypeNode.get("properties");
fieldTypes.put(importFieldType.getName(),
new TestFieldType(importFieldType, table, repository, propertiesNode));
}
}
// Record type
JsonNode recordTypesNode = configNode.get("recordTypes");
if (recordTypesNode != null && recordTypesNode.isArray()) {
for (JsonNode recordTypeNode : recordTypesNode) {
String recordTypeName = JsonUtil.getString(recordTypeNode, "name");
QName recordTypeQName = QNameConverter.fromJson(recordTypeName, jsonImport.getNamespaces());
recordType = repository.getTypeManager().newRecordType(recordTypeQName);
TestRecordType testRecordType = new TestRecordType();
// Fields
for (JsonNode fieldNode : recordTypeNode.get("fields")) {
String fieldName = JsonUtil.getString(fieldNode, "name");