Examples of LibraryDef


Examples of org.auraframework.def.LibraryDef

    /**
     * Verify the loading of libraryDefs.
     */
    public void testGetLibraryInstance() throws Exception {
        LibraryDef libDef = Aura.getDefinitionService().getDefinition("test:test_Library", LibraryDef.class);
        assertNotNull(libDef);

        List<IncludeDefRef> includes = libDef.getIncludes();
        assertEquals(8, includes.size());
        assertInclude(includes.get(0), "basicFirst", null, null);
        assertInclude(includes.get(1), "basicSecond", null, null);
        assertInclude(includes.get(2), "hasVars", null, "firstVar");
        assertInclude(includes.get(3), "expectsImport", "basicFirst", null);
View Full Code Here

Examples of org.auraframework.def.LibraryDef

    /**
     * Tests the ordering logic of the {@link LibraryDef} to ensure that imports will be serialized in order.
     */
    public void testIncludeOrdering() throws Exception {
        LibraryDef libDef = Aura.getDefinitionService().getDefinition("test:test_LibraryOrdering", LibraryDef.class);
        assertNotNull(libDef);

        List<IncludeDefRef> includes = libDef.getIncludes();
        assertEquals(5, includes.size());
        assertEquals("e", includes.get(0).getName());
        assertEquals("d", includes.get(1).getName());
        assertEquals("c", includes.get(2).getName());
        assertEquals("b", includes.get(3).getName());
View Full Code Here

Examples of org.auraframework.def.LibraryDef

    /**
     * Tests the ordering logic of the {@link LibraryDef} to ensure that imports will be serialized in order.
     */
    public void testIncludeOrderingOneDependsOnRest() throws Exception {
        LibraryDef libDef = Aura.getDefinitionService().getDefinition(
                "test:test_LibraryIncludeOrderingOneDependsOnRest", LibraryDef.class);
        assertNotNull(libDef);

        String libraryName1 = libDef.getIncludes().get(0).getName();
        String libraryName2 = libDef.getIncludes().get(1).getName();
        String libraryName3 = libDef.getIncludes().get(2).getName();

        assertEquals(4, libDef.getIncludes().size());

        // Ensure no dependency-included-twice malarkey:
        assertFalse(libraryName1.equals(libraryName2));
        assertFalse(libraryName2.equals(libraryName3));
        assertFalse(libraryName1.equals(libraryName3));

        // a, b, c are not required to be in any particular order since they have no dependencies:
        assertTrue(libraryName1.equals("a") || libraryName1.equals("b") || libraryName1.equals("c"));
        assertTrue(libraryName2.equals("a") || libraryName2.equals("b") || libraryName2.equals("c"));
        assertTrue(libraryName3.equals("a") || libraryName3.equals("b") || libraryName3.equals("c"));

        // d needs to be the last included dependency:
        assertEquals("d", libDef.getIncludes().get(3).getName());
    }
View Full Code Here

Examples of org.auraframework.def.LibraryDef

    /**
     * Tests the ordering logic of the {@link LibraryDef} to ensure a mix of external and internal dependencies work.
     */
    public void testLibraryOrderingInternalExternalMix() throws Exception {
        LibraryDef libDef = Aura.getDefinitionService().getDefinition("test:test_LibraryOrderingInternalExternalMix",
                LibraryDef.class);
        assertNotNull(libDef);

        // c only depends on something external, it has no library level dependencies and hence is first:
        assertEquals("c", libDef.getIncludes().get(0).getName());
        // b depends on c so it will be chosen second:
        assertEquals("b", libDef.getIncludes().get(1).getName());
        // a has both external and library dependencies, it depends on c and b and is therefore last:
        assertEquals("a", libDef.getIncludes().get(2).getName());
    }
View Full Code Here

Examples of org.auraframework.def.LibraryDef

    /**
     * Tests the {@link LibraryDef} (and {@link IncludeDefRef}) serialization.
     */
    public void testSerialization() throws Exception {
        LibraryDef libDef = Aura.getDefinitionService().getDefinition("test:test_Library", LibraryDef.class);
        assertNotNull(libDef);

        ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
        Json json = Json.createJsonStream(baos, false, false, false);
        libDef.serialize(json);
        json.close();

        String actual = new String(baos.toByteArray(), Charsets.UTF_8).replaceAll("\\s", "");
        goldFileJson(actual);
    }
View Full Code Here

Examples of org.auraframework.def.LibraryDef

            // Add all imported libraries AND their source to the documentation.
            if (definition instanceof ComponentDef) {
                Collection<ImportDef> importDefs = ((ComponentDef) definition).getImportDefs();

                for (ImportDef importDef : importDefs) {
                    LibraryDef libraryDef = Aura.getDefinitionService().getDefinition(importDef.getLibraryDescriptor());
                    if (ReferenceTreeModel.hasAccess(libraryDef)) {
                        defs.add(new DefModel(libraryDef.getDescriptor()));

                        // Treat the included js files specially because they load source differently:
                        for (IncludeDefRef includeDef : libraryDef.getIncludes()) {
                            includeDefs.add(new IncludeDefModel(includeDef.getIncludeDescriptor()));
                        }
                    }
                }
            }
View Full Code Here

Examples of org.auraframework.def.LibraryDef

        // Add all imported libraries AND their source to the documentation.
        if (def instanceof ComponentDef) {
            Collection<ImportDef> importDefs = ((ComponentDef) def).getImportDefs();

            for (ImportDef importDef : importDefs) {
                LibraryDef libraryDef = Aura.getDefinitionService().getDefinition(importDef.getLibraryDescriptor());
                if (ReferenceTreeModel.hasAccess(libraryDef)) {
                    defs.add(new DefModel(libraryDef.getDescriptor()));

                    // Treat the included js files specially because they load source differently:
                    for (IncludeDefRef includeDef : libraryDef.getIncludes()) {
                        includeDefs.add(new IncludeDefModel(includeDef.getIncludeDescriptor()));
                    }
                }
            }
        }
View Full Code Here

Examples of org.auraframework.def.LibraryDef

                "<%s><%s name='sanity'/></%1$s>",
                LibraryDefHandler.TAG, IncludeDefRefHandler.TAG), "myID", Format.XML);
        Mockito.doReturn(DefType.LIBRARY).when(descriptor).getDefType();
        LibraryDefHandler handler = new LibraryDefHandler(descriptor, source, getReader(source));

        LibraryDef actualDef = handler.getElement();
        assertSame(descriptor, actualDef.getDescriptor());
        List<IncludeDefRef> includes = actualDef.getIncludes();
        assertEquals(1, includes.size());
        assertEquals("sanity", includes.get(0).getName());
    }
View Full Code Here

Examples of org.auraframework.def.LibraryDef

    public void testGetElementWithEmptyTag() throws Exception {
        StringSource<LibraryDef> source = new StringSource<>(descriptor, String.format("<%s></%1$s>",
                LibraryDefHandler.TAG), "myID", Format.XML);
        LibraryDefHandler handler = new LibraryDefHandler(descriptor, source, getReader(source));

        LibraryDef actualDef = handler.getElement();
        assertSame(descriptor, actualDef.getDescriptor());
        assertTrue(actualDef.getIncludes().isEmpty());
    }
View Full Code Here

Examples of org.auraframework.def.LibraryDef

        String expectedDescription = "needs to be included";
        StringSource<LibraryDef> source = new StringSource<>(descriptor, String.format("<%s description='%s'></%1$s>",
                LibraryDefHandler.TAG, expectedDescription), "myID", Format.XML);
        LibraryDefHandler handler = new LibraryDefHandler(descriptor, source, getReader(source));

        LibraryDef actualDef = handler.getElement();
        assertEquals(expectedDescription, actualDef.getDescription());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.