Package org.auraframework.instance

Examples of org.auraframework.instance.ComponentConfig


        openNoAura(url);
        assertTrue(getText(By.cssSelector("body")).contains(String.format("%s did not provide a valid component",
                providerDefDescriptor.getQualifiedName())));

        // mock provided attributes
        ComponentConfig componentConfig = new ComponentConfig();
        Map<String, Object> attribs = ImmutableMap.of("echo", (Object) "goodbye");
        componentConfig.setAttributes(attribs);
        mockingUtil.mockServerProviderDef(providerDefDescriptor, componentConfig);
        openNoAura(url);
        assertEquals("goodbye", getText(By.cssSelector("body")));
    }
View Full Code Here


        builder.setDescription("A custom built component");
        List<ComponentDefRef> body = Lists.newArrayList();
        body.add(contents.build());
        builder.setFacet("body", body);
        ds.getDefRegistry().addLocalDef(builder.build());
        ComponentConfig cc = new ComponentConfig();
        cc.setDescriptor(newDesc);
        return cc;
    }
View Full Code Here

@Provider
public class TestJavaProviderSettingAttributeValuesViaComponentConfig implements ComponentConfigProvider {
    @Override
    public ComponentConfig provide() throws QuickFixException {
        ComponentConfig c = new ComponentConfig();

        c.setDescriptor(DefDescriptorImpl.getInstance(
                "test:testJavaProviderSettingAttributeValuesViaComponentConfigHelper", ComponentDef.class));
        c.setAttributes(provideAttributes());

        return c;
    }
View Full Code Here

@Provider
public class TestJavaProviderSettingAttributeValues implements ComponentConfigProvider {
    @Override
    public ComponentConfig provide() throws QuickFixException {
        ComponentConfig config = new ComponentConfig();

        config.setDescriptor(DefDescriptorImpl.getInstance("test:testJavaProviderSettingAttributeValuesHelper",
                    ComponentDef.class));
        Map<String, Object> attributes = new HashMap<>();
        attributes.put("a1", "a1Provider");
        attributes.put("a2", null);
        attributes.put("b1", "b1Provider");
        attributes.put("ar1", new String[] { "ar1Provider0", "ar1Provider1" });

        BaseComponent<?, ?> component = Aura.getContextService().getCurrentContext().getCurrentComponent();

        if (component.getAttributes().getValue("a3") != null) {
            attributes.put("b2", "b2Provider");
        }

        config.setAttributes(attributes);
        return config;
    }
View Full Code Here

*/
@Provider
public class TestComponentConfigProvider implements ComponentConfigProvider {
    @Override
    public ComponentConfig provide() {
        ComponentConfig config = new ComponentConfig();

        config.setDescriptor(DefDescriptorImpl.getInstance("test:test_Preload_Interface_Impl", ComponentDef.class));
        return config;
    }
View Full Code Here

        return DefDescriptorImpl.getInstance("test:fakeApplication", ApplicationDef.class);
    }

    @Override
    public ComponentConfig provide() throws QuickFixException {
        ComponentConfig config = new ComponentConfig();

        BaseComponent<?, ?> component = Aura.getContextService().getCurrentContext().getCurrentComponent();
        String whatToDo = (String) component.getAttributes().getExpression("whatToDo");
        if (whatToDo.equalsIgnoreCase("label")) {
            Map<String, Object> attrs = Maps.newHashMap();
            attrs.put("name", "Null Returned");
            config.setAttributes(attrs);
        } else if (whatToDo.equalsIgnoreCase("replace")) {
            config.setDescriptor(DefDescriptorImpl.getInstance("test:test_Provider_Concrete_Sub", ComponentDef.class));
        } else if (whatToDo.equalsIgnoreCase("replaceBad")) {
            @SuppressWarnings("unchecked")
            DefDescriptor<ComponentDef> foo = (DefDescriptor<ComponentDef>) getMagicDescriptor();

            config.setDescriptor(foo);
        } else if (whatToDo.equalsIgnoreCase("replaceNotFound")) {
            config.setDescriptor(DefDescriptorImpl.getInstance("test:test_Provider_Concrete_Sub_NotHere",
                    ComponentDef.class));
        } else if (whatToDo.equalsIgnoreCase("provideTestModelParentCmp")) {
            config.setDescriptor(DefDescriptorImpl.getInstance("auratest:test_Model_Parent",
                    ComponentDef.class));
        } else if (whatToDo.equalsIgnoreCase("mockRecordLayout")) {
          //this is the mimic of recordLayoutProvider.
          //being used by DynamicnamespaceUITest and PreloadNameSpaceHttpTest.testDynamicNamespace
            String hash = "HASH";
            String hashName = String.format("layout://%s_%s_%s_%s_%s:c", "rl",
                    "001", "VIEW", "ACCOUNT", hash);
            DefDescriptor<ComponentDef> hashedDescriptor = DefDescriptorImpl.getInstance(hashName,
                    ComponentDef.class);
            Builder builder = new ComponentDefImpl.Builder();
            builder.setDescriptor(hashedDescriptor);
            //set up attribute definitions. we don't need "whatToDo" any more, but the build still require it
            Map<DefDescriptor<AttributeDef>, AttributeDef> attributeDefs = new HashMap<>();
            DefDescriptor<TypeDef> type = DefDescriptorImpl.getInstance("String", TypeDef.class);
            attributeDefs.put(DefDescriptorImpl.getInstance("whatToDo", AttributeDef.class), new AttributeDefImpl(
                    DefDescriptorImpl.getInstance("whatToDo", AttributeDef.class), null, type, null, true,
                    AttributeDef.SerializeToType.BOTH, null, null));
      builder.attributeDefs = attributeDefs;
            ComponentDef cmpDef = builder.build();
            AuraContext context = Aura.getContextService().getCurrentContext();
            //add dynamic namespace to MasterDefRegistry so later we can getDef from it during the injectComponent();
            MasterDefRegistry mdr = context.getDefRegistry();
            mdr.addLocalDef(cmpDef);
            config.setDescriptor(cmpDef.getDescriptor());
        }
        return config;
    }
View Full Code Here

@Provider
public class TestComponnetConfigProviderAIS implements ComponentConfigProvider {
    @Override
    public ComponentConfig provide() {
        ComponentConfig config = new ComponentConfig();
        Map<String, Object> m = Maps.newHashMapWithExpectedSize(1);
        m.put("valueFromJavaProvider", "valueFromJavaProvider");
        config.setAttributes(m);
        return config;
    }
View Full Code Here

TOP

Related Classes of org.auraframework.instance.ComponentConfig

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.