Package org.apache.hivemind.util

Examples of org.apache.hivemind.util.ClasspathResource


        assertNull(l2);
    }

    public void testClasspathLocalizeDefault()
    {
        Resource l1 = new ClasspathResource(_resolver, "/org/apache/hivemind/util/home.png");
        Resource actual = l1.getLocalization(Locale.KOREAN);

        assertSame(l1, actual);
    }
View Full Code Here


        assertSame(l1, actual);
    }

    public void testClasspathLocalizeNull()
    {
        Resource l1 = new ClasspathResource(_resolver, "/org/apache/hivemind/util/home.png");
        Resource actual = l1.getLocalization(null);

        assertSame(l1, actual);
    }
View Full Code Here

        assertSame(l1, actual);
    }

    public void testEqualsNull()
    {
        Resource l1 = new ClasspathResource(_resolver, "/org/apache/hivemind/util/home.png");

        assertTrue(!l1.equals(null));
    }
View Full Code Here

        assertTrue(!l1.equals(null));
    }

    public void testClasspathRelativeSamePath()
    {
        Resource l1 = new ClasspathResource(_resolver, "/foo/bar/Baz");
        Resource l2 = l1.getRelativeResource("/foo/bar/Baz");

        assertSame(l1, l2);
    }
View Full Code Here

        assertSame(l1, l2);
    }

    public void testTrailingSlash()
    {
        Resource l1 = new ClasspathResource(_resolver, "/");
        Resource expected = new ClasspathResource(_resolver, "/foo");
        Resource actual = l1.getRelativeResource("foo");

        assertEquals(expected, actual);
    }
View Full Code Here

    public void testResourceTranslator() throws Exception
    {
        RegistryBuilder builder = new RegistryBuilder();

        Resource moduleResource = new ClasspathResource(_resolver,
                "/hivemind/test/config/ResourceTranslator.xml");

        builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(_resolver));
        builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(_resolver,
                moduleResource));

        Registry r = builder.constructRegistry(Locale.FRENCH);

        List l = r.getConfiguration("hivemind.test.config.ResourceTranslator");

        interceptLogging();

        assertEquals(4, l.size());

        ResourceHolder h = (ResourceHolder) l.get(0);

        assertEquals(moduleResource.getRelativeResource("Empty.xml"), h.getResource());

        h = (ResourceHolder) l.get(1);

        assertEquals(moduleResource.getRelativeResource("Localized_fr.properties"), h.getResource());

        h = (ResourceHolder) l.get(2);
        assertNull(h.getResource());

        h = (ResourceHolder) l.get(3);
View Full Code Here

{
    public void testDefaultErrorHandlerWithLocation()
    {
        Log log = (Log) newMock(Log.class);

        Resource r = new ClasspathResource(new DefaultClassResolver(), "/foo/bar/Baz.module");
        Location l = new LocationImpl(r, 13);

        Throwable ex = new IllegalArgumentException();

        log.error("Error at classpath:/foo/bar/Baz.module, line 13: Bad frob value.", ex);
View Full Code Here

        return createAsset(localized, location);
    }

    public IAsset createAbsoluteAsset(String path, Locale locale, Location location)
    {
        Resource base = new ClasspathResource(_classResolver, path);
        Resource localized = _localizer.findLocalization(base, locale);

        if (localized == null)
            throw new ApplicationRuntimeException(AssetMessages.missingClasspathResource(path),
                    location, null);
View Full Code Here

        return createAsset(localized, location);
    }

    public IAsset createAsset(Resource resource, Location location)
    {
        ClasspathResource cr = (ClasspathResource) resource;

        return new PrivateAsset(cr, _assetService, location);
    }
View Full Code Here

        _pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, field);
    }

    public void includeClasspathScript(String path)
    {
        Resource resource = new ClasspathResource(_resolver, path);

        _pageRenderSupport.addExternalScript(resource);
    }
View Full Code Here

TOP

Related Classes of org.apache.hivemind.util.ClasspathResource

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.