Package org.auraframework.impl.java.renderer

Examples of org.auraframework.impl.java.renderer.JavaRendererDef


     */
    public void testClassDoesNotImplementRenderer() throws Exception {
        JavaRendererDef.Builder builder = new JavaRendererDef.Builder();
        builder.setDescriptor(DefDescriptorImpl.getInstance(
                "java://org.auraframework.impl.renderer.sampleJavaRenderers.TestSimpleRenderer", RendererDef.class));
        JavaRendererDef def = builder.build();

        try {
            def.validateDefinition();
            fail("JavaRendererDef cannot be created if interface not implemented.");
        } catch (Exception e) {
            checkExceptionFull(e, InvalidDefinitionException.class, "Renderer must implement the Renderer interface.");
        }
    }
View Full Code Here


    /**
     * Verify that server side renderers are defined as local.
     */
    public void testIsLocal() throws Exception {
        JavaRendererDef.Builder builder = new JavaRendererDef.Builder().setRendererClass(TestSimpleRenderer.class);
        JavaRendererDef def = builder.build();
        assertTrue("Server side renderers should be defined as Local", def.isLocal());
    }
View Full Code Here

    /**
     * Verify that JavaRendererDef creates nothing when serialized.
     */
    public void testSerializedFormat() throws Exception {
        JavaRendererDef def = createRenderer("java://org.auraframework.impl.renderer.sampleJavaRenderers.TestSimpleRenderer");
        assertTrue(Json.serialize(def, false, false).isEmpty());
    }
View Full Code Here

     *
     * @expectedResults JavaRendererDef.render() function accepts a character stream and returns the stream, populated
     *                  with markup.
     */
    public void testInvokeRender() throws Exception {
        JavaRendererDef def = createRenderer("java://org.auraframework.impl.renderer.sampleJavaRenderers.TestSimpleRenderer");
        def.render(dummyCmp, sw);
        this.goldFileText(sw.toString());
    }
View Full Code Here

     *
     * ComponentImpl just makes render() call on the RenderDef object. All exceptions should be wrapped in
     * AuraExecutionException, while errors and quickfix exceptions are passed through.
     */
    public void testExceptionThrownByComponentRendererHandled() throws Exception {
        JavaRendererDef def = createRenderer("java://org.auraframework.impl.renderer.sampleJavaRenderers.TestSimpleRenderer");
        IOException ioe = new IOException();
        AuraError err = new AuraError("expected");
        RuntimeException re = new RuntimeException("expected");

        try {
            def.render(null, new AppendableThrower(ioe));
            fail("no exception on a throwing appendable");
        } catch (AuraExecutionException expected) {
            assertEquals("Did not throw wrapped IOException", ioe, expected.getCause());
        }

        try {
            def.render(null, new AppendableThrower(err));
            fail("No exception on a throwing appendable.");
        } catch (AuraError expected) {
            assertEquals("Did not throw error", err, expected);
        }

        try {
            def.render(null, new AppendableThrower(re));
            fail("no exception on a throwing appendable");
        } catch (AuraExecutionException expected) {
            assertEquals("Did not throw error", re, expected.getCause());
        }

        // Make sure ArithmeticExceptions are wrapped and sent up the chain
        def = createRenderer("java://org.auraframework.impl.renderer.sampleJavaRenderers.TestRendererThrowingException");
        try {
            def.render(dummyCmp, sw);
            fail("Should be able to catch exceptions during rendering.");
        } catch (AuraExecutionException e) {
            // The thrown Exception should be AuraExecutionException, but we should still have the ArithemeticException
            // with the correct message for the cause
            checkExceptionFull(e.getCause(), ArithmeticException.class, "From TestRendererThrowingException");
        }

        // Make sure QuickFixExceptions are not swallowed
        def = createRenderer("java://org.auraframework.impl.renderer.sampleJavaRenderers.TestRendererThrowsQFEDuringRender");
        try {
            def.render(dummyCmp, sw);
            fail("Should be able to catch QuickFixExceptions during rendering.");
        } catch (Exception e) {
            checkExceptionFull(e, InvalidDefinitionException.class, "From TestRendererThrowsQFEDuringRender");
        }
    }
View Full Code Here

TOP

Related Classes of org.auraframework.impl.java.renderer.JavaRendererDef

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.