Search in sources :

Example 1 with AxisServiceWsdlGenerator

use of org.pentaho.platform.plugin.services.webservices.content.AxisServiceWsdlGenerator in project pentaho-platform by pentaho.

the class WsdlPageTest method setUp.

@Before
public void setUp() {
    beforeTestCfg = AxisWebServiceManager.currentAxisConfiguration;
    beforeTestCtx = AxisWebServiceManager.currentAxisConfigContext;
    AxisConfiguration axisCfg = new AxisConfiguration();
    AxisWebServiceManager.currentAxisConfiguration = axisCfg;
    AxisWebServiceManager.currentAxisConfigContext = new ConfigurationContext(axisCfg);
    out = new ByteArrayOutputStream();
    IOutputHandler outputHandler = new SimpleOutputHandler(out, false);
    outputHandler.setMimeTypeListener(new MimeTypeListener());
    StandaloneSession session = new StandaloneSession("test");
    StubServiceSetup serviceSetup = new StubServiceSetup();
    serviceSetup.setSession(session);
    contentGenerator = new AxisServiceWsdlGenerator();
    contentGenerator.setOutputHandler(outputHandler);
    contentGenerator.setMessagesList(new ArrayList<String>());
    contentGenerator.setSession(session);
    contentGenerator.setUrlFactory(new SimpleUrlFactory(BASE_URL + "?"));
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisServiceWsdlGenerator(org.pentaho.platform.plugin.services.webservices.content.AxisServiceWsdlGenerator) IOutputHandler(org.pentaho.platform.api.engine.IOutputHandler) StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) SimpleOutputHandler(org.pentaho.platform.engine.core.output.SimpleOutputHandler) ByteArrayOutputStream(java.io.ByteArrayOutputStream) SimpleUrlFactory(org.pentaho.platform.util.web.SimpleUrlFactory) Before(org.junit.Before)

Example 2 with AxisServiceWsdlGenerator

use of org.pentaho.platform.plugin.services.webservices.content.AxisServiceWsdlGenerator in project pentaho-platform by pentaho.

the class AxisServiceWsdlGeneratorTest method testBadInit3.

@Test
public void testBadInit3() throws Exception {
    // $NON-NLS-1$
    StandaloneSession session = new StandaloneSession("test");
    AxisServiceWsdlGenerator contentGenerator = new AxisServiceWsdlGenerator();
    // $NON-NLS-1$
    assertNotNull("contentGenerator is null", contentGenerator);
    // $NON-NLS-1$
    assertNotNull("Logger is null", contentGenerator.getLogger());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    IOutputHandler outputHandler = new SimpleOutputHandler(out, false);
    // $NON-NLS-1$
    String baseUrl = "http://testhost:testport/testcontent";
    Map<String, IParameterProvider> parameterProviders = new HashMap<String, IParameterProvider>();
    SimpleParameterProvider requestParams = new SimpleParameterProvider();
    parameterProviders.put(IParameterProvider.SCOPE_REQUEST, requestParams);
    // $NON-NLS-1$
    SimpleUrlFactory urlFactory = new SimpleUrlFactory(baseUrl + "?");
    List<String> messages = new ArrayList<String>();
    contentGenerator.setOutputHandler(outputHandler);
    MimeTypeListener mimeTypeListener = new MimeTypeListener();
    outputHandler.setMimeTypeListener(mimeTypeListener);
    contentGenerator.setMessagesList(messages);
    contentGenerator.setParameterProviders(parameterProviders);
    contentGenerator.setSession(session);
    contentGenerator.setUrlFactory(urlFactory);
    contentGenerator.createContent();
    String content = new String(out.toByteArray());
    System.out.println(content);
    assertTrue(content.indexOf(Messages.getInstance().getErrorString("WebServiceContentGenerator.ERROR_0001_AXIS_CONFIG_IS_NULL")) != // $NON-NLS-1$
    -1);
}
Also used : StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SimpleOutputHandler(org.pentaho.platform.engine.core.output.SimpleOutputHandler) ByteArrayOutputStream(java.io.ByteArrayOutputStream) AxisServiceWsdlGenerator(org.pentaho.platform.plugin.services.webservices.content.AxisServiceWsdlGenerator) IOutputHandler(org.pentaho.platform.api.engine.IOutputHandler) IParameterProvider(org.pentaho.platform.api.engine.IParameterProvider) SimpleUrlFactory(org.pentaho.platform.util.web.SimpleUrlFactory) SimpleParameterProvider(org.pentaho.platform.engine.core.solution.SimpleParameterProvider) Test(org.junit.Test)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOutputHandler (org.pentaho.platform.api.engine.IOutputHandler)2 SimpleOutputHandler (org.pentaho.platform.engine.core.output.SimpleOutputHandler)2 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)2 AxisServiceWsdlGenerator (org.pentaho.platform.plugin.services.webservices.content.AxisServiceWsdlGenerator)2 SimpleUrlFactory (org.pentaho.platform.util.web.SimpleUrlFactory)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)1 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)1 Before (org.junit.Before)1 Test (org.junit.Test)1 IParameterProvider (org.pentaho.platform.api.engine.IParameterProvider)1 SimpleParameterProvider (org.pentaho.platform.engine.core.solution.SimpleParameterProvider)1