Package org.auraframework.instance

Examples of org.auraframework.instance.Component


     */
    public void testOverrideInterfaceAttributes() throws Exception {
        Map<String, Object> attributes = Maps.newHashMap();

        attributes.put("implNumber", "OverrideAttr");
        Component component = Aura.getInstanceService().getInstance("test:test_Provider_Interface", ComponentDef.class,
                attributes);
        assertEquals("Java Provider: Failed to retrieve the right implementation for the interface.", component
                .getDescriptor().getQualifiedName(), "markup://test:test_Provider_providerImplOverrideAttr");
        // Verify that the attributes passed off to the interface were inherited
        // by the component provided by the
        // provider
        assertEquals("Attribute values of implementing component were overriden by values defined for interface",
                component.getAttributes().getExpression("implNumber"), "OverrideAttr");
        assertEquals("Failed to initialize attributes on the component",
                component.getAttributes().getExpression("defaultAttr"), "meh");
    }
View Full Code Here


     * <li>provider:providerB which should instantiate as is.
     * </ul>
     */
    @SuppressWarnings("unchecked")
    public void testConcreteWithProvider() throws Exception {
        Component component = Aura.getInstanceService().getInstance("provider:providerC", ComponentDef.class);
        List<? extends Component> body = (List<? extends Component>) component.getSuper().getAttributes()
                .getValue("body");
        assertEquals("First element must be concrete provider A", "markup://provider:providerA", body.get(0)
                .getDescriptor().getQualifiedName());
        assertEquals("Second element must be concrete provider B", "markup://provider:providerB", body.get(1)
                .getDescriptor().getQualifiedName());
View Full Code Here

     * Abstract component's provider returns a component which extends the abstract class
     *
     * @throws Exception
     */
    public void testProviderAbstractBasic() throws Exception {
        Component component = Aura.getInstanceService().getInstance("test:test_Provider_AbstractBasic",
                ComponentDef.class);
        assertEquals("Java Provider: Failed to retrieve the component extending abstract component.", component
                .getDescriptor().getQualifiedName(), "markup://test:test_Provider_AbstractBasicExtends");
    }
View Full Code Here

     */
    @Ignore("W-777620")
    public void testProviderForAbstractComponent() throws Exception {
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("implNumber", "4");
        Component component = Aura.getInstanceService().getInstance("test:test_Provider_Interface", ComponentDef.class,
                attributes);
        assertEquals("Java Provider: Failed to retrieve the right implementation for the interface.", component
                .getDescriptor().getQualifiedName(), "markup://test:test_Provider_providerImpl4");

        component = Aura.getInstanceService().getInstance(component.getDescriptor().getQualifiedName(),
                ComponentDef.class, attributes);
        assertEquals("Java Provider: Failed to retrieve the right implementation for the abstract component.",
                component.getDescriptor().getQualifiedName(), "markup://test:test_Provider_Abstract4");

    }
View Full Code Here

     */
    @Ignore("W-777620")
    public void testProviderForAbstractComponentProvidesAbstractComponent() throws Exception {
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("implNumber", "2");
        Component component = Aura.getInstanceService().getInstance("test:test_Provider_Abstract1", ComponentDef.class,
                attributes);
        assertEquals("Java Provider: Failed to retrieve the right implementation for the abstract component.",
                component.getDescriptor().getQualifiedName(), "markup://test:test_Provider_Abstract2");

        attributes.put("implNumber", "3");
        component = Aura.getInstanceService().getInstance(component.getDescriptor().getQualifiedName(),
                ComponentDef.class, attributes);
        assertEquals("Java Provider: Failed to retrieve the right implementation for the component.", component
                .getDescriptor().getQualifiedName(), "markup://test:test_Provider_Abstract3");

    }
View Full Code Here

        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("a1", "a1");
        attributes.put("a2", "a2");
        attributes.put("value", "aura");
        Component component = Aura.getInstanceService().getInstance(compName, ComponentDef.class, attributes);
        assertEquals("a1 should have been updated by provider", "a1Provider", component.getAttributes().getValue("a1"));
        assertEquals("b1 should have been set by provider", "b1Provider", component.getAttributes().getValue("b1"));

        assertNull("a2 should have been updated by provider to null", component.getAttributes().getValue("a2"));
        assertNull("b2 should not have been set", component.getAttributes().getValue("b2"));

        attributes.clear();
        attributes.put("a3", "a3");
        attributes.put("value", "aura");
        component = Aura.getInstanceService().getInstance(compName, ComponentDef.class, attributes);
        assertEquals("b2 should have been set by provider", "b2Provider", component.getAttributes().getValue("b2"));

        attributes.clear();
        try {
            component = Aura.getInstanceService().getInstance(compName, ComponentDef.class, attributes);
            fail("'value' is required on the underlying concrete component. This should have thrown an exception as provider also didn't set it.");
        } catch (AuraValidationException e) {
            assertEquals(MissingRequiredAttributeException.getMessage(component.getDescriptor(), "value"),
                    e.getMessage());
        }
    }
View Full Code Here

    @AuraEnabled
    public static Object getComponents(@Key("token") String token, @Key("input") String input) throws Exception {
        int count = Integer.parseInt(input);
        List<Component> cmps = new LinkedList<>();
        while (count-- > 0) {
            Component cmp = Aura.getInstanceService().getInstance("auratest:text", ComponentDef.class);
            Object val = token + ":java:" + count;
            Map<String, Object> atts = ImmutableMap.of("value", val);
            cmp.getAttributes().set(atts);
            cmps.add(cmp);
        }
        return cmps.toArray();
    }
View Full Code Here

            @Key("max") BigDecimal max, @Key("min") BigDecimal min) throws DefinitionNotFoundException,
            QuickFixException {
        log.info("api:getInputNumberCmp values received on server:" + " value:" + value + " step:" + step + " max:"
                + max + " min:" + min);
        Map<String, Object> attributes = Maps.newHashMap();
        Component inputNumCmp = null;

        attributes.put("value", value);
        attributes.put("aura:id", "inputNumber");
        attributes.put("step", step);
        attributes.put("max", max);
View Full Code Here

    @AuraEnabled
    public static Component getOutputNumberCmp(@Key("inVar") BigDecimal inVar) throws DefinitionNotFoundException,
            QuickFixException {
        log.info("getOutputNumberCmp value received on server:" + inVar);
        Map<String, Object> attributes = Maps.newHashMap();
        Component outputCmp = null;
        try {
            attributes.put("value", inVar);
            outputCmp = Aura.getInstanceService().getInstance("ui:outputNumber", ComponentDef.class, attributes);
        } catch (Exception nfe) {
            StringWriter errors = new StringWriter();
View Full Code Here

    @AuraEnabled
    public static Component getOutputPercentStringCmp(@Key("inVar") BigDecimal inVar)
            throws DefinitionNotFoundException, QuickFixException {
        log.info("api:getOutputPercentStringCmp value received on server:" + inVar);
        Map<String, Object> attributes = Maps.newHashMap();
        Component outputCmp = null;
        try {
            attributes.put("value", inVar);
            outputCmp = Aura.getInstanceService().getInstance("ui:outputPercent", ComponentDef.class, attributes);
        } catch (Exception nfe) {
            StringWriter errors = new StringWriter();
View Full Code Here

TOP

Related Classes of org.auraframework.instance.Component

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.