GauloisPipe { public URIResolver getUriResolver() { if(uriResolver==null) { uriResolver = buildUriResolver(configurationFactory.getConfiguration().getURIResolver()); } return uriResolver; } @SuppressWarnings("OverridableMethodCallInConstructor")  GauloisPipe(final SaxonConfigurationFactory configurationFactory);  GauloisPipe(final SaxonConfigurationFactory configurationFactory, List<String> inputs, String outputDirectory,List<String> templatePaths, int nbThreads, String instanceName); @SuppressWarnings("ThrowFromFinallyBlock") void launch(); int getDocumentCacheSize(); int getXsltCacheSize(); List<String> getErrors(); Config getConfig(); void execute(Pipe pipe, ParametrableFile input, MessageListener listener, Map<String,OutputStream> ... outputs); void doPostCloseService(ExecutionContext context); static void main(String[] args); void setMessageListenerclass(Class messageListenerclass); @SuppressWarnings("LocalVariableHidesMemberVariable") Config parseCommandLine(String[] args); URIResolver getUriResolver(); EntityResolver2 getEntityResolver(); void setInstanceName(String instanceName); void setConfig(Config config); String getInstanceName(); void setThreadFactory(ThreadFactory threadFactory); void collectError(Exception ex, String... message); void collectError(GauloisRunException ex, String... message); DatatypeFactory getDatatypeFactory(); static void setProtocolInstalled(final boolean installed); static boolean isProtocolInstalled(); static final String INSTANCE_DEFAULT_NAME; static final transient String GAULOIS_DEBUG_DIR_PROPERTY; }
@Test(expected = InvalidSyntaxException.class) public void testInitialTeeStep() throws Exception { GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), "./src/test/resources/tee-initial-step.xml"); Config config = cu.buildConfig(emptyInputParams); config.verify(); }
@Test(expected = InvalidSyntaxException.class) public void testIncompleteTrace() throws Exception { GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), "./src/test/resources/incompleteTrace.xml"); Config config = cu.buildConfig(emptyInputParams); }
@Test(expected = InvalidSyntaxException.class) public void testNoSource() throws Exception { GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), "./src/test/resources/no-source.xml"); Config config = cu.buildConfig(emptyInputParams); config.verify(); }
@Test public void testLoadingParams() throws Exception { GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), "./src/test/resources/param-override.xml"); ParameterValue pv = new ParameterValue(new QName("outputDirPath"), "..", factory.XS_STRING); HashMap<QName,ParameterValue> params = new HashMap<>(); params.put(pv.getKey(), pv); Config config = cu.buildConfig(params); assertEquals(config.getParams().get(new QName("outputDirPath")).getValue(), ".."); }
@Test(expected = InvalidSyntaxException.class) public void testNoOutput() throws Exception { GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), "./src/test/resources/no-output.xml"); Config config = cu.buildConfig(emptyInputParams); config.verify(); }
@Test(expected = InvalidSyntaxException.class) public void testChooseAtRoot() throws Exception { String sample = "./src/test/resources/choose-at-root.xml"; GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), sample); Config config = cu.buildConfig(emptyInputParams); config.verify(); }
@Test(expected = InvalidSyntaxException.class) public void testChooseAtRootExec() throws Exception { String sample = "./src/test/resources/choose-at-root.xml"; GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), sample); Config config = cu.buildConfig(emptyInputParams); config.verify(); }
@Test(expected = InvalidSyntaxException.class) public void testTeeAtRootExec() throws Exception { String sample = "./src/test/resources/tee-at-root.xml"; GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), sample); Config config = cu.buildConfig(emptyInputParams); config.verify(); }
@Test(expected = InvalidSyntaxException.class) public void testTeeFirstOfSubpipe() throws Exception { String sample = "./src/test/resources/tee-first-of-subpipe.xml"; GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), sample); Config config = cu.buildConfig(emptyInputParams); config.verify(); }
@Test(expected = InvalidSyntaxException.class) public void testChooseFirstOfSubpipe() throws Exception { String sample = "./src/test/resources/choose-first-of-subpipe.xml"; GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), sample); Config config = cu.buildConfig(emptyInputParams); config.verify(); }
@Test public void validateComment() throws ValidationException { try { GauloisPipe piper = new GauloisPipe(configFactory); Config config = new ConfigUtil(configFactory.getConfiguration(),piper.getUriResolver(), "./src/test/resources/comment-xslt.xml").buildConfig(emptyInputParams); config.verify(); Iterator<ParametrableStep> it = config.getPipe().getXslts(); int count=0; while(it.hasNext()) { it.next(); count++; } assertEquals(3, count); } catch (InvalidSyntaxException | SaxonApiException ex) { fail(ex.getMessage()); } }
@Test(expected = InvalidSyntaxException.class) public void testInitialJavaStepKo() throws Exception { GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), "./src/test/resources/java-initial-step-ko.xml"); Config config = cu.buildConfig(emptyInputParams); config.verify(); }
@Test() public void testInitialJavaStepOk() throws Exception { GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), "./src/test/resources/java-initial-step-ok.xml"); Config config = cu.buildConfig(emptyInputParams); config.verify(); }