Search in sources :

Example 11 with Notifier

use of org.apache.cxf.javascript.JavascriptTestUtilities.Notifier in project cxf by apache.

the class DocLitBareClientTest method compliantCaller.

private Void compliantCaller(Context context) {
    TestBean1 b1 = new TestBean1();
    b1.stringItem = "strung";
    b1.beanTwoNotRequiredItem = new TestBean2("bean2");
    Scriptable jsBean1 = testBean1ToJS(testUtilities, context, b1);
    LOG.info("About to call compliant" + getAddress());
    Notifier notifier = testUtilities.rhinoCallConvert("compliantTest", Notifier.class, testUtilities.javaToJS(getAddress()), jsBean1);
    boolean notified = notifier.waitForJavascript(1000 * 10);
    assertTrue(notified);
    Integer errorStatus = testUtilities.rhinoEvaluateConvert("globalErrorStatus", Integer.class);
    assertNull(errorStatus);
    String errorText = testUtilities.rhinoEvaluateConvert("globalErrorStatusText", String.class);
    assertNull(errorText);
    // This method returns a String
    String response = (String) testUtilities.rhinoEvaluate("globalResponseObject");
    assertEquals("strung", response);
    return null;
}
Also used : TestBean1(org.apache.cxf.javascript.fortest.TestBean1) TestBean2(org.apache.cxf.javascript.fortest.TestBean2) Scriptable(org.mozilla.javascript.Scriptable) Notifier(org.apache.cxf.javascript.JavascriptTestUtilities.Notifier)

Example 12 with Notifier

use of org.apache.cxf.javascript.JavascriptTestUtilities.Notifier in project cxf by apache.

the class DocLitBareClientTest method compliantNoArgsCaller.

private Void compliantNoArgsCaller(Context context) {
    LOG.info("About to call compliantNoArgs " + getAddress());
    Notifier notifier = testUtilities.rhinoCallConvert("compliantNoArgsTest", Notifier.class, testUtilities.javaToJS(getAddress()));
    boolean notified = notifier.waitForJavascript(1000 * 10);
    assertTrue(notified);
    Integer errorStatus = testUtilities.rhinoEvaluateConvert("globalErrorStatus", Integer.class);
    assertNull(errorStatus);
    String errorText = testUtilities.rhinoEvaluateConvert("globalErrorStatusText", String.class);
    assertNull(errorText);
    // This method returns a String
    Scriptable response = (Scriptable) testUtilities.rhinoEvaluate("globalResponseObject");
    String item = testUtilities.rhinoCallMethodConvert(String.class, response, "getStringItem");
    assertEquals("horsefeathers", item);
    return null;
}
Also used : Scriptable(org.mozilla.javascript.Scriptable) Notifier(org.apache.cxf.javascript.JavascriptTestUtilities.Notifier)

Example 13 with Notifier

use of org.apache.cxf.javascript.JavascriptTestUtilities.Notifier in project cxf by apache.

the class RPCClientTest method simpleCaller.

private Void simpleCaller(Context context) {
    LOG.info("About to call simpleTest " + getAddress());
    Notifier notifier = testUtilities.rhinoCallConvert("simpleTest", Notifier.class, testUtilities.javaToJS(getAddress()), "String Parameter", testUtilities.javaToJS(new Integer(1776)));
    boolean notified = notifier.waitForJavascript(1000 * 10);
    assertTrue(notified);
    Integer errorStatus = testUtilities.rhinoEvaluateConvert("globalErrorStatus", Integer.class);
    assertNull(errorStatus);
    String errorText = testUtilities.rhinoEvaluateConvert("globalErrorStatusText", String.class);
    assertNull(errorText);
    // this method returns a String.
    String responseObject = testUtilities.rhinoEvaluateConvert("globalResponseObject", String.class);
    assertEquals("String Parameter", responseObject);
    SimpleRPCImpl impl = getBean(SimpleRPCImpl.class, "rpc-service");
    assertEquals("String Parameter", impl.getLastString());
    assertEquals(1776, impl.getLastInt());
    return null;
}
Also used : SimpleRPCImpl(org.apache.cxf.javascript.fortest.SimpleRPCImpl) Notifier(org.apache.cxf.javascript.JavascriptTestUtilities.Notifier)

Aggregations

Notifier (org.apache.cxf.javascript.JavascriptTestUtilities.Notifier)13 Scriptable (org.mozilla.javascript.Scriptable)5 TestBean1 (org.apache.cxf.javascript.fortest.TestBean1)3 TestBean2 (org.apache.cxf.javascript.fortest.TestBean2)3 InputStream (java.io.InputStream)1 Reader (java.io.Reader)1 XPath (javax.xml.xpath.XPath)1 CountDownNotifier (org.apache.cxf.javascript.JavascriptTestUtilities.CountDownNotifier)1 SimpleDocLitBareImpl (org.apache.cxf.javascript.fortest.SimpleDocLitBareImpl)1 SimpleDocLitWrappedImpl (org.apache.cxf.javascript.fortest.SimpleDocLitWrappedImpl)1 SimpleRPCImpl (org.apache.cxf.javascript.fortest.SimpleRPCImpl)1 EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)1 AbstractCXFSpringTest (org.apache.cxf.test.AbstractCXFSpringTest)1 Test (org.junit.Test)1 Document (org.w3c.dom.Document)1