Package org.auraframework.clientlibrary

Examples of org.auraframework.clientlibrary.ClientLibraryResolver


        }

        String url = clientLibrary.getUrl();
        if (StringUtils.isBlank(url)) {
            // Use resolver if url is blank
            ClientLibraryResolver resolver = getResolver(clientLibrary);
            if (resolver != null) {
                url = resolver.getUrl();
            }
        }
        return url;
    }
View Full Code Here


            return false;
        }

        if (StringUtils.isBlank(clientLibrary.getUrl())) {
            // Use resolver if url is blank
            ClientLibraryResolver resolver = getResolver(clientLibrary);
            if (resolver != null) {
                return clientLibrary.shouldCombine() && resolver.canCombine();
            } else {
                throw new ClientLibraryException("Client library must have resolver if url is blank: "
                        + clientLibrary.getLibraryName(), clientLibrary.getLocation());
            }
        }
View Full Code Here

     */
    private Combinable getCombinable(ClientLibraryDef clientLibrary) throws QuickFixException {
        String url = clientLibrary.getUrl();
        Combinable combinable = null;
        if (StringUtils.isBlank(url)) {
            ClientLibraryResolver resolver = getResolver(clientLibrary);
            if (resolver != null && resolver.canCombine()) {
                // combinable resolver
                combinable = (Combinable) resolver;
            }
        } else if (StringUtils.startsWithIgnoreCase(url, DefDescriptor.CSS_PREFIX + "://") ||
                StringUtils.startsWithIgnoreCase(url, DefDescriptor.JAVASCRIPT_PREFIX + "://")) {
View Full Code Here

    public void testCanCombine() throws Exception {
        assertFalse(clientLibraryService.canCombine(null));

        ClientLibraryDef combinableURL = vendor.makeClientLibraryDef("combinableUrl_test", "", Type.JS,
                null, true, null, null);
        ClientLibraryResolver combinableResolver = new ClientLibraryResolver() {
            @Override
            public String getName() {
                return "combinableUrl_test";
            }

            @Override
            public Type getType() {
                return Type.JS;
            }

            @Override
            public boolean canCombine() {
                return true;
            }

            @Override
            public String getLocation() {
                return null;
            }

            @Override
            public String getUrl() {
                return null;
            }
        };
        ClientLibraryResolverRegistryImpl.INSTANCE.register(combinableResolver);
        assertTrue(clientLibraryService.canCombine(combinableURL));

        ClientLibraryResolver unCombinableResolver = new ClientLibraryResolver() {
            @Override
            public String getName() {
                return "combinableUrl_test";
            }
View Full Code Here

    public void testRegister() {
        ClientLibraryResolverRegistry reg = ClientLibraryResolverRegistryImpl.INSTANCE;
        reg.register(null);

        ClientLibraryResolver nullValues = new ClientLibraryResolver() {
            @Override
            public String getName() {
                return null;
            }

            @Override
            public Type getType() {
                return null;
            }

            @Override
            public String getLocation() {
                return null;
            }

            @Override
            public String getUrl() {
                return null;
            }

            @Override
            public boolean canCombine() {
                return false;
            }
        };
        reg.register(nullValues);
        assertNull(reg.get(null, null));

        ClientLibraryResolver customResolver = new ClientLibraryResolver() {
            @Override
            public String getName() {
                return "Kangaroo";
            }

            @Override
            public Type getType() {
                return Type.JS;
            }

            @Override
            public String getLocation() {
                return null;
            }

            @Override
            public String getUrl() {
                return null;
            }

            @Override
            public boolean canCombine() {
                return false;
            }
        };
        assertNull(reg.get("Kangaroo", Type.JS));
        reg.register(customResolver);
        assertEquals("Could not register and look up custom resolver.", customResolver, reg.get("Kangaroo", Type.JS));

        ClientLibraryResolver overrideCustomResolver = new ClientLibraryResolver() {
            @Override
            public String getName() {
                return "Kangaroo";
            }
View Full Code Here

        assertResolvers("CkEditor", Type.JS, AuraResourceResolver.class);
    }
   
    private void assertResolvers(String name, Type type, Class<?> expectedResolver){
        ClientLibraryResolverRegistry reg = ClientLibraryResolverRegistryImpl.INSTANCE;
        ClientLibraryResolver resolver = reg.get(name, type);
        assertNotNull("Failed to find resolver for "+name+" of type "+type.toString(), resolver);
        assertTrue(expectedResolver.isInstance(resolver));
    }
View Full Code Here

TOP

Related Classes of org.auraframework.clientlibrary.ClientLibraryResolver

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.