Package org.apache.cxf.javascript.fortest

Examples of org.apache.cxf.javascript.fortest.TestBean1


        XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(stringReader);
        QName testBeanQName = new QName("uri:org.apache.cxf.javascript.testns", "TestBean1");
        Object bean = reader.read(testBeanQName, xmlStreamReader, TestBean1.class);
        assertNotNull(bean);
        assertTrue(bean instanceof TestBean1);
        TestBean1 testBean = (TestBean1)bean;
        assertEquals("bean1<stringItem", testBean.stringItem);
        assertEquals(64, testBean.intItem);
        assertEquals(64000000, testBean.longItem);
        assertEquals(101, testBean.optionalIntItem);
        assertNotNull(testBean.optionalIntArrayItem);
View Full Code Here


        implementor.resetLastValues();
    }

    private Void beanFunctionCaller(Context context) {
       
        TestBean1 b1 = new TestBean1();
        b1.stringItem = "strung";
        TestBean1[] beans = new TestBean1[3];
        beans[0] = new TestBean1();
        beans[0].stringItem = "zerobean";
        beans[0].beanTwoNotRequiredItem = new TestBean2("bean2");
        beans[1] = null;
        beans[2] = new TestBean1();
        beans[2].stringItem = "twobean";
        beans[2].optionalIntArrayItem = new int[2];
        beans[2].optionalIntArrayItem[0] = 4;
        beans[2].optionalIntArrayItem[1] = 6;
       
        Object[] jsBeans = new Object[3];
        jsBeans[0] = testBean1ToJS(testUtilities, context, beans[0]);
        jsBeans[1] = null;
        jsBeans[2] = testBean1ToJS(testUtilities, context, beans[2]);
       
        Scriptable jsBean1 = testBean1ToJS(testUtilities, context, b1);
        Scriptable jsBeanArray = context.newArray(testUtilities.getRhinoScope(), jsBeans);
       
        LOG.info("About to call beanFunctionTest " + getAddress());
        Notifier notifier =
            testUtilities.rhinoCallConvert("beanFunctionTest", Notifier.class,
                                           testUtilities.javaToJS(getAddress()),
                                           jsBean1,
                                           jsBeanArray);
        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 void.
        Scriptable responseObject = (Scriptable)testUtilities.rhinoEvaluate("globalResponseObject");
        // there is no response, this thing returns 'void'
        assertNull(responseObject);
        SimpleDocLitBareImpl impl = (SimpleDocLitBareImpl)rawImplementor;
        TestBean1 b1returned = impl.getLastBean1();
        assertEquals(b1, b1returned);
        // commented out until
        //TestBean1[] beansReturned = impl.getLastBean1Array();
        //assertArrayEquals(beans, beansReturned);
        return null;
View Full Code Here

        //assertArrayEquals(beans, beansReturned);
        return null;
    }
   
    private Void compliantCaller(Context context) {
        TestBean1 b1 = new TestBean1();
        b1.stringItem = "strung";

        b1.beanTwoNotRequiredItem = new TestBean2("bean2");
       
        Scriptable jsBean1 = testBean1ToJS(testUtilities, context, b1);
View Full Code Here

    public void testDeserialization() throws Exception {
        setupClientAndRhino("simple-dlwu-proxy-factory");
        testUtilities.readResourceIntoRhino("/deserializationTests.js");
        DataBinding dataBinding = new JAXBDataBinding(TestBean1.class, TestBean2.class);
        assertNotNull(dataBinding);
        TestBean1 bean = new TestBean1();
        bean.stringItem = "bean1>stringItem";
        bean.doubleItem = -1.0;
        String serialized = serializeObject(dataBinding, bean);
        testUtilities.rhinoCallInContext("deserializeTestBean3_1", serialized);

        bean = new TestBean1();
        bean.stringItem = null;
        bean.intItem = 21;
        bean.longItem = 200000001;
        bean.optionalIntItem = 456123;
        bean.optionalIntArrayItem = new int[4];
View Full Code Here

        XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(stringReader);
        QName testBeanQName = new QName("uri:org.apache.cxf.javascript.testns", "TestBean1");
        Object bean = reader.read(testBeanQName, xmlStreamReader, TestBean1.class);
        assertNotNull(bean);
        assertTrue(bean instanceof TestBean1);
        TestBean1 testBean = (TestBean1)bean;
        assertEquals("bean1<stringItem", testBean.stringItem);
        assertEquals(64, testBean.intItem);
        assertEquals(64000000, testBean.longItem);
        assertEquals(101, testBean.optionalIntItem);
        assertNotNull(testBean.optionalIntArrayItem);
View Full Code Here

    protected String[] getConfigLocations() {
        return new String[] {"classpath:DocLitWrappedClientTestBeans.xml"};
    }

    private Void beanFunctionCaller(Context context, boolean useWrapper) {
        TestBean1 b1 = new TestBean1();
        b1.stringItem = "strung";
        TestBean1[] beans = new TestBean1[3];
        beans[0] = new TestBean1();
        beans[0].beanTwoNotRequiredItem = new TestBean2("bean2");
        if (useWrapper) {
            beans[1] = null;
        } else {
            // without a wrapper, it can't be null, so put something in there.
            beans[1] = new TestBean1();
        }
        beans[2] = new TestBean1();
        beans[2].optionalIntArrayItem = new int[2];
        beans[2].optionalIntArrayItem[0] = 4;
        beans[2].optionalIntArrayItem[1] = 6;
       
        Object[] jsBeans = new Object[3];
        jsBeans[0] = testBean1ToJS(testUtilities, context, beans[0]);
        jsBeans[1] = testBean1ToJS(testUtilities, context, beans[1]);
        jsBeans[2] = testBean1ToJS(testUtilities, context, beans[2]);
       
        Scriptable jsBean1 = testBean1ToJS(testUtilities, context, b1);
        Scriptable jsBeanArray = context.newArray(testUtilities.getRhinoScope(), jsBeans);
       
        LOG.info("About to call test4 " + getAddress());
        Notifier notifier =
            testUtilities.rhinoCallConvert("test4", Notifier.class,
                                           testUtilities.javaToJS(getAddress()),
                                           testUtilities.javaToJS(Boolean.valueOf(useWrapper)),
                                           jsBean1,
                                           jsBeanArray);
        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 void, which translated into a Javascript object with no properties.
        // really. Void.
        Object responseObject = testUtilities.rhinoEvaluate("globalResponseObject");
        assertNotNull(responseObject);
        assertEquals(Context.getUndefinedValue(), responseObject);
        SimpleDocLitWrappedImpl impl = (SimpleDocLitWrappedImpl)rawImplementor;
        TestBean1 b1returned = impl.getLastBean1();
        assertEquals(b1, b1returned);
        TestBean1[] beansReturned = impl.getLastBean1Array();
        assertArrayEquals(beans, beansReturned);
        return null;
    }
View Full Code Here

        implementor.resetLastValues();
    }

    private Void beanFunctionCaller(Context context) {
       
        TestBean1 b1 = new TestBean1();
        b1.stringItem = "strung";
        TestBean1[] beans = new TestBean1[3];
        beans[0] = new TestBean1();
        beans[0].stringItem = "zerobean";
        beans[0].beanTwoNotRequiredItem = new TestBean2("bean2");
        beans[1] = null;
        beans[2] = new TestBean1();
        beans[2].stringItem = "twobean";
        beans[2].optionalIntArrayItem = new int[2];
        beans[2].optionalIntArrayItem[0] = 4;
        beans[2].optionalIntArrayItem[1] = 6;
       
        Object[] jsBeans = new Object[3];
        jsBeans[0] = testBean1ToJS(testUtilities, context, beans[0]);
        jsBeans[1] = null;
        jsBeans[2] = testBean1ToJS(testUtilities, context, beans[2]);
       
        Scriptable jsBean1 = testBean1ToJS(testUtilities, context, b1);
        Scriptable jsBeanArray = context.newArray(testUtilities.getRhinoScope(), jsBeans);
       
        LOG.info("About to call beanFunctionTest " + getAddress());
        Notifier notifier =
            testUtilities.rhinoCallConvert("beanFunctionTest", Notifier.class,
                                           testUtilities.javaToJS(getAddress()),
                                           jsBean1,
                                           jsBeanArray);
        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 void.
        Scriptable responseObject = (Scriptable)testUtilities.rhinoEvaluate("globalResponseObject");
        // there is no response, this thing returns 'void'
        assertNull(responseObject);
        SimpleDocLitBareImpl impl = (SimpleDocLitBareImpl)rawImplementor;
        TestBean1 b1returned = impl.getLastBean1();
        assertEquals(b1, b1returned);
        // commented out until
        //TestBean1[] beansReturned = impl.getLastBean1Array();
        //assertArrayEquals(beans, beansReturned);
        return null;
View Full Code Here

        //assertArrayEquals(beans, beansReturned);
        return null;
    }
   
    private Void compliantCaller(Context context) {
        TestBean1 b1 = new TestBean1();
        b1.stringItem = "strung";

        b1.beanTwoNotRequiredItem = new TestBean2("bean2");
       
        Scriptable jsBean1 = testBean1ToJS(testUtilities, context, b1);
View Full Code Here

        return null;
    }

    private Void beanFunctionCaller(Context context) {
       
        TestBean1 b1 = new TestBean1();
        b1.stringItem = "strung";
        TestBean1[] beans = new TestBean1[3];
        beans[0] = new TestBean1();
        beans[0].stringItem = "zerobean";
        beans[0].beanTwoNotRequiredItem = new TestBean2("bean2");
        beans[1] = null;
        beans[2] = new TestBean1();
        beans[2].stringItem = "twobean";
        beans[2].optionalIntArrayItem = new int[2];
        beans[2].optionalIntArrayItem[0] = 4;
        beans[2].optionalIntArrayItem[1] = 6;
       
        Object[] jsBeans = new Object[3];
        jsBeans[0] = testBean1ToJS(testUtilities, context, beans[0]);
        jsBeans[1] = null;
        jsBeans[2] = testBean1ToJS(testUtilities, context, beans[2]);
       
        Scriptable jsBean1 = testBean1ToJS(testUtilities, context, b1);
        Scriptable jsBeanArray = context.newArray(testUtilities.getRhinoScope(), jsBeans);
       
        LOG.info("About to call beanFunctionTest " + getAddress());
        Notifier notifier =
            testUtilities.rhinoCallConvert("beanFunctionTest", Notifier.class,
                                           testUtilities.javaToJS(getAddress()),
                                           jsBean1,
                                           jsBeanArray);
        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 void.
        Scriptable responseObject = (Scriptable)testUtilities.rhinoEvaluate("globalResponseObject");
        // there is no response, this thing returns 'void'
        assertNull(responseObject);
        SimpleRPCImpl impl = getBean(SimpleRPCImpl.class, "rpc-service");
        TestBean1 b1returned = impl.getLastBean();
        assertEquals(b1, b1returned);
        return null;
    }
View Full Code Here

    public void testDeserialization() throws Exception {
        setupClientAndRhino("simple-dlwu-proxy-factory");
        testUtilities.readResourceIntoRhino("/deserializationTests.js");
        DataBinding dataBinding = new JAXBDataBinding(TestBean1.class, TestBean2.class);
        assertNotNull(dataBinding);
        TestBean1 bean = new TestBean1();
        bean.stringItem = "bean1>stringItem";
        bean.doubleItem = -1.0;
        String serialized = serializeObject(dataBinding, bean);
        testUtilities.rhinoCallInContext("deserializeTestBean3_1", serialized);

        bean = new TestBean1();
        bean.stringItem = null;
        bean.intItem = 21;
        bean.longItem = 200000001;
        bean.optionalIntItem = 456123;
        bean.optionalIntArrayItem = new int[4];
View Full Code Here

TOP

Related Classes of org.apache.cxf.javascript.fortest.TestBean1

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.