@Test @Ignore public void testCreateSolrSchema() throws Exception { service.createSolrSchema(StreamsHelper.COLUMNS, CONF_FOLDER.getRoot().getAbsolutePath()); File schemaFile= new File(CONF_FOLDER.getRoot().getAbsolutePath() + File.separator + "schema.xml"); assertTrue("Expected true value not found", schemaFile.canRead()); }
public void createSolrSchema(List<ColumnNameTypeValue> columns, String confpath) throws ParserConfigurationException, URISyntaxException, IOException, SAXException, TransformerException { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setIgnoringComments(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse(new File(ClassLoader.getSystemResource("./solr-config/schema.xml").toURI())); NodeList nodes = doc.getElementsByTagName("schema"); for (ColumnNameTypeValue column: columns) { Element field = doc.createElement("field"); field.setAttribute("name", column.getColumn()); field.setAttribute("type", streamingToSolr(column.getType())); field.setAttribute("indexed", "true"); field.setAttribute("stored", "true"); nodes.item(0).appendChild(field); } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult streamResult = new StreamResult(new File(confpath+"/schema.xml")); transformer.transform(source, streamResult); }
SolrOperationsService { public void createSolrSchema(List<ColumnNameTypeValue> columns, String confpath) throws ParserConfigurationException, URISyntaxException, IOException, SAXException, TransformerException { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setIgnoringComments(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse(new File(ClassLoader.getSystemResource("./solr-config/schema.xml").toURI())); NodeList nodes = doc.getElementsByTagName("schema"); for (ColumnNameTypeValue column: columns) { Element field = doc.createElement("field"); field.setAttribute("name", column.getColumn()); field.setAttribute("type", streamingToSolr(column.getType())); field.setAttribute("indexed", "true"); field.setAttribute("stored", "true"); nodes.item(0).appendChild(field); } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult streamResult = new StreamResult(new File(confpath+"/schema.xml")); transformer.transform(source, streamResult); } }
SolrOperationsService { public void createSolrSchema(List<ColumnNameTypeValue> columns, String confpath) throws ParserConfigurationException, URISyntaxException, IOException, SAXException, TransformerException { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setIgnoringComments(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse(new File(ClassLoader.getSystemResource("./solr-config/schema.xml").toURI())); NodeList nodes = doc.getElementsByTagName("schema"); for (ColumnNameTypeValue column: columns) { Element field = doc.createElement("field"); field.setAttribute("name", column.getColumn()); field.setAttribute("type", streamingToSolr(column.getType())); field.setAttribute("indexed", "true"); field.setAttribute("stored", "true"); nodes.item(0).appendChild(field); } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult streamResult = new StreamResult(new File(confpath+"/schema.xml")); transformer.transform(source, streamResult); } SolrOperationsService(String solrHosts, String zkHosts, String dataDir, Boolean isCloud); }
SolrOperationsService { public void createSolrSchema(List<ColumnNameTypeValue> columns, String confpath) throws ParserConfigurationException, URISyntaxException, IOException, SAXException, TransformerException { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setIgnoringComments(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse(new File(ClassLoader.getSystemResource("./solr-config/schema.xml").toURI())); NodeList nodes = doc.getElementsByTagName("schema"); for (ColumnNameTypeValue column: columns) { Element field = doc.createElement("field"); field.setAttribute("name", column.getColumn()); field.setAttribute("type", streamingToSolr(column.getType())); field.setAttribute("indexed", "true"); field.setAttribute("stored", "true"); nodes.item(0).appendChild(field); } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult streamResult = new StreamResult(new File(confpath+"/schema.xml")); transformer.transform(source, streamResult); } SolrOperationsService(String solrHosts, String zkHosts, String dataDir, Boolean isCloud); void createCore(StratioStreamingMessage message); void createDirs(String dataPath, String confPath); void createSolrConfig(String confPath); void createSolrSchema(List<ColumnNameTypeValue> columns, String confpath); List<String> getCoreList(); }
SolrOperationsService { public void createSolrSchema(List<ColumnNameTypeValue> columns, String confpath) throws ParserConfigurationException, URISyntaxException, IOException, SAXException, TransformerException { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setIgnoringComments(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse(new File(ClassLoader.getSystemResource("./solr-config/schema.xml").toURI())); NodeList nodes = doc.getElementsByTagName("schema"); for (ColumnNameTypeValue column: columns) { Element field = doc.createElement("field"); field.setAttribute("name", column.getColumn()); field.setAttribute("type", streamingToSolr(column.getType())); field.setAttribute("indexed", "true"); field.setAttribute("stored", "true"); nodes.item(0).appendChild(field); } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult streamResult = new StreamResult(new File(confpath+"/schema.xml")); transformer.transform(source, streamResult); } SolrOperationsService(String solrHosts, String zkHosts, String dataDir, Boolean isCloud); void createCore(StratioStreamingMessage message); void createDirs(String dataPath, String confPath); void createSolrConfig(String confPath); void createSolrSchema(List<ColumnNameTypeValue> columns, String confpath); List<String> getCoreList();  }