@Test public void testPreProcessing() throws IOException, SAXException, ParserConfigurationException, TransformerException { String expectedDev = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" + " <admin version=\"2.0\">\n" + " <adminserver hostalias=\"node0\"/>\n" + " </admin>\n" + " <content id=\"foo\" version=\"1.0\">\n" + " <redundancy>1</redundancy>\n" + " <documents>\n" + " <document mode=\"index\" type=\"music.sd\"/>\n" + " </documents>\n" + " <nodes>\n" + " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" + " </nodes>\n" + " </content>\n" + " <container id=\"stateless\" version=\"1.0\">\n" + " <search/>\n" + " <component bundle=\"foobundle\" class=\"MyFoo\" id=\"foo\"/>\n" + " <component bundle=\"foobundle\" class=\"TestBar\" id=\"bar\"/>\n" + " <nodes>\n" + " <node hostalias=\"node0\" baseport=\"5000\"/>\n" + " </nodes>\n" + " </container>\n" + "</services>"; TestBase.assertDocument(expectedDev, new XmlPreProcessor(appDir, services, InstanceName.defaultName(), Environment.dev, RegionName.from("default")).run()); String expectedStaging = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" + " <admin version=\"2.0\">\n" + " <adminserver hostalias=\"node1\"/>\n" + " </admin>\n" + " <content id=\"foo\" version=\"1.0\">\n" + " <redundancy>1</redundancy>\n" + " <documents>\n" + " <document mode=\"index\" type=\"music.sd\"/>\n" + " </documents>\n" + " <nodes>\n" + " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" + " </nodes>\n" + " </content>\n" + " <container id=\"stateless\" version=\"1.0\">\n" + " <search/>\n" + " <component bundle=\"foobundle\" class=\"MyFoo\" id=\"foo\"/>\n" + "" + " <nodes>\n" + " <node hostalias=\"node0\" baseport=\"5000\"/>\n" + " </nodes>\n" + " </container>\n" + "</services>"; TestBase.assertDocument(expectedStaging, new XmlPreProcessor(appDir, services, InstanceName.defaultName(), Environment.staging, RegionName.from("default")).run()); String expectedUsWest = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" + " <admin version=\"2.0\">\n" + " <adminserver hostalias=\"node0\"/>\n" + " </admin>\n" + " <content id=\"foo\" version=\"1.0\">\n" + " <redundancy>1</redundancy>\n" + " <documents>\n" + " <document mode=\"index\" type=\"music.sd\"/>\n" + " </documents>\n" + " <nodes>\n" + " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" + " <node distribution-key=\"1\" hostalias=\"node1\"/>\n" + " <node distribution-key=\"2\" hostalias=\"node2\"/>\n" + " </nodes>\n" + " </content>\n" + " <container id=\"stateless\" version=\"1.0\">\n" + " <search>\n" + " <chain id=\"common\">\n" + " <searcher id=\"MySearcher1\"/>\n" + " <searcher id=\"MySearcher2\"/>\n" + " </chain>\n" + " </search>\n" + " <component bundle=\"foobundle\" class=\"MyFoo\" id=\"foo\"/>\n" + " <component bundle=\"foobundle\" class=\"ProdBar\" id=\"bar\"/>\n" + " <component bundle=\"foobundle\" class=\"ProdBaz\" id=\"baz\"/>\n" + " <nodes>\n" + " <node hostalias=\"node0\" baseport=\"5001\"/>\n" + " </nodes>\n" + " </container>\n" + "</services>"; TestBase.assertDocument(expectedUsWest, new XmlPreProcessor(appDir, services, InstanceName.defaultName(), Environment.prod, RegionName.from("us-west")).run()); String expectedUsEastAndCentral = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" + " <admin version=\"2.0\">\n" + " <adminserver hostalias=\"node1\"/>\n" + " </admin>\n" + " <content id=\"foo\" version=\"1.0\">\n" + " <redundancy>1</redundancy>\n" + " <documents>\n" + " <document mode=\"index\" type=\"music.sd\"/>\n" + " </documents>\n" + " <nodes>\n" + " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" + " <node distribution-key=\"1\" hostalias=\"node1\"/>\n" + " </nodes>\n" + " </content>\n" + " <container id=\"stateless\" version=\"1.0\">\n" + " <search>\n" + " <chain id=\"common\">\n" + " <searcher id=\"MySearcher1\"/>\n" + " <searcher id=\"MySearcher2\"/>\n" + " </chain>\n" + " </search>\n" + " <component bundle=\"foobundle\" class=\"MyFoo\" id=\"foo\"/>\n" + " <component bundle=\"foobundle\" class=\"ProdBar\" id=\"bar\"/>\n" + " <component bundle=\"foobundle\" class=\"ProdBaz\" id=\"baz\"/>\n" + " <nodes>\n" + " <node hostalias=\"node0\" baseport=\"5002\"/>\n" + " </nodes>\n" + " </container>\n" + "</services>"; TestBase.assertDocument(expectedUsEastAndCentral, new XmlPreProcessor(appDir, services, InstanceName.defaultName(), Environment.prod, RegionName.from("us-east")).run()); TestBase.assertDocument(expectedUsEastAndCentral, new XmlPreProcessor(appDir, services, InstanceName.defaultName(), Environment.prod, RegionName.from("us-central")).run()); }
public Document run() throws ParserConfigurationException, IOException, SAXException, TransformerException { DocumentBuilder docBuilder = Xml.getPreprocessDocumentBuilder(); Document document = docBuilder.parse(new InputSource(xmlInput)); return execute(document); }
XmlPreProcessor { public Document run() throws ParserConfigurationException, IOException, SAXException, TransformerException { DocumentBuilder docBuilder = Xml.getPreprocessDocumentBuilder(); Document document = docBuilder.parse(new InputSource(xmlInput)); return execute(document); } }
XmlPreProcessor { public Document run() throws ParserConfigurationException, IOException, SAXException, TransformerException { DocumentBuilder docBuilder = Xml.getPreprocessDocumentBuilder(); Document document = docBuilder.parse(new InputSource(xmlInput)); return execute(document); } XmlPreProcessor(File applicationDir, File xmlInput, InstanceName instance, Environment environment, RegionName region);  XmlPreProcessor(File applicationDir, Reader xmlInput, InstanceName instance, Environment environment, RegionName region);  XmlPreProcessor(FileWrapper applicationDir, Reader xmlInput, InstanceName instance, Environment environment, RegionName region); }
XmlPreProcessor { public Document run() throws ParserConfigurationException, IOException, SAXException, TransformerException { DocumentBuilder docBuilder = Xml.getPreprocessDocumentBuilder(); Document document = docBuilder.parse(new InputSource(xmlInput)); return execute(document); } XmlPreProcessor(File applicationDir, File xmlInput, InstanceName instance, Environment environment, RegionName region);  XmlPreProcessor(File applicationDir, Reader xmlInput, InstanceName instance, Environment environment, RegionName region);  XmlPreProcessor(FileWrapper applicationDir, Reader xmlInput, InstanceName instance, Environment environment, RegionName region); Document run(); }
XmlPreProcessor { public Document run() throws ParserConfigurationException, IOException, SAXException, TransformerException { DocumentBuilder docBuilder = Xml.getPreprocessDocumentBuilder(); Document document = docBuilder.parse(new InputSource(xmlInput)); return execute(document); } XmlPreProcessor(File applicationDir, File xmlInput, InstanceName instance, Environment environment, RegionName region);  XmlPreProcessor(File applicationDir, Reader xmlInput, InstanceName instance, Environment environment, RegionName region);  XmlPreProcessor(FileWrapper applicationDir, Reader xmlInput, InstanceName instance, Environment environment, RegionName region); Document run();  }