public static JarEntityResolver getInstance() { if ( JarEntityResolver.instance == null ) { JarEntityResolver.instance = new JarEntityResolver(); } return JarEntityResolver.instance; }
public void testFailureTransformXML() throws Exception { String parameterXsl = "DefaultParameterForm.xsl"; //$NON-NLS-1$ String xslPath = "system/custom/xsl"; Map<String, String> parameters = new HashMap<String, String>(); String actionUrl = "http://localhost:8080/pentaho/ViewAction?"; //$NON-NLS-1$ String baseUrl = "http://localhost:8080/pentaho"; //$NON-NLS-1$ String displayUrl = "http://localhost:8080/pentaho"; //$NON-NLS-1$ parameters.put( "baseUrl", baseUrl ); //$NON-NLS-1$ parameters.put( "actionUrl", actionUrl ); //$NON-NLS-1$ parameters.put( "displayUrl", displayUrl ); // $NON-NLS-1$ Document document = XmlDom4JHelper.getDocFromString( "<?xml version=\"1.0\" encoding=\"windows-1252\"?><root></root>", null ); //$NON-NLS-1$ assertEquals( document.getRootElement().getName(), "root" ); //$NON-NLS-1$ XmlHelper.transformXml( parameterXsl, xslPath, document.asXML(), parameters, new JarEntityResolver() ); }
public void testFailureTransformXML3() throws Exception { String parameterXsl = "DefaultParameterForm.xsl"; //$NON-NLS-1$ String xslPath = "system/custom/xsl"; Map parameters = new HashMap(); String actionUrl = "http://localhost:8080/pentaho/ViewAction?"; //$NON-NLS-1$ String baseUrl = "http://localhost:8080/pentaho"; //$NON-NLS-1$ String displayUrl = "http://localhost:8080/pentaho"; //$NON-NLS-1$ parameters.put( "baseUrl", baseUrl ); //$NON-NLS-1$ parameters.put( "actionUrl", actionUrl ); //$NON-NLS-1$ parameters.put( "displayUrl", displayUrl ); //$NON-NLS-1$ Document document = XmlDom4JHelper.getDocFromString( "<?xml version=\"1.0\" encoding=\"" + "UTF-8" + "\" ?><filters xmlns:xf=\"http://www.w3.org/2002/xforms\">" + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "<Header/>" + "<id><![CDATA[" + //$NON-NLS-1$ //$NON-NLS-2$ "]]></id><description><![CDATA[" + //$NON-NLS-1$ "MyDescription" + "]]></description><icon><![CDATA[" + //$NON-NLS-1$ //$NON-NLS-2$ "GetIcon" + "]]></icon><help><![CDATA[" + //$NON-NLS-1$ //$NON-NLS-2$ "GetHelp" + "]]></help>" + //$NON-NLS-1$ //$NON-NLS-2$ "<action><![CDATA[" + actionUrl + "]]></action>" + //$NON-NLS-1$ //$NON-NLS-2$ "<display><![CDATA[" + displayUrl + "]]></display>" + //$NON-NLS-1$ //$NON-NLS-2$ "<Body/>" + "</filters>", null ); //$NON-NLS-1$ //$NON-NLS-2$ XmlHelper.transformXml( parameterXsl, xslPath, new ByteArrayInputStream( document.asXML().getBytes() ), parameters, new JarEntityResolver() ); }
public void testFailureTransformXML2() throws Exception { String parameterXsl = "DefaultParameterForm.xsl"; //$NON-NLS-1$ String xslPath = "system/custom/xsl"; Map parameters = new HashMap(); String actionUrl = "http://localhost:8080/pentaho/ViewAction?"; //$NON-NLS-1$ String baseUrl = "http://localhost:8080/pentaho"; //$NON-NLS-1$ String displayUrl = "http://localhost:8080/pentaho"; //$NON-NLS-1$ parameters.put( "baseUrl", baseUrl ); //$NON-NLS-1$ parameters.put( "actionUrl", actionUrl ); //$NON-NLS-1$ parameters.put( "displayUrl", displayUrl ); //$NON-NLS-1$ String xmlString = "<?xml version=\"1.0\" encoding=\"" + "UTF-8" + "\" ?><filters xmlns:xf=\"http://www.w3.org/2002/xforms\">" + // $NON-NLS-1$ // //$NON-NLS-2$ // //$NON-NLS-3$ "<Header/>" + "<id><![CDATA[" + //$NON-NLS-1$ //$NON-NLS-2$ "]]></id><description><![CDATA[" + //$NON-NLS-1$ "MyDescription" + "]]></description><icon><![CDATA[" + //$NON-NLS-1$ //$NON-NLS-2$ "GetIcon" + "]]></icon><help><![CDATA[" + //$NON-NLS-1$ //$NON-NLS-2$ "GetHelp" + "]]></help>" + //$NON-NLS-1$ //$NON-NLS-2$ "<action><![CDATA[" + actionUrl + "]]></action>" + //$NON-NLS-1$ //$NON-NLS-2$ "<display><![CDATA[" + displayUrl + "]]></display>" + //$NON-NLS-1$ //$NON-NLS-2$ "<Body/>" + "</filters>"; //$NON-NLS-1$ //$NON-NLS-2$ Document document = XmlDom4JHelper.getDocFromString( xmlString, null ); XmlHelper.transformXml( parameterXsl, xslPath, document.asXML(), parameters, new JarEntityResolver() ); }