Package org.apache.hivemind

Examples of org.apache.hivemind.Resource


    public void testAddDupeSchema() throws Exception
    {
        ModuleDescriptor md = new ModuleDescriptor(getClassResolver(), new DefaultErrorHandler());
        md.setModuleId("foo");

        Resource r = new ClasspathResource(getClassResolver(), "/foo/bar");
        Location l1 = new LocationImpl(r, 20);
        Location l2 = new LocationImpl(r, 97);

        SchemaImpl s1 = new SchemaImpl("test");
        s1.setId("bar");
View Full Code Here


        RegistryBuilder builder = new RegistryBuilder();

        for (int i = 0; i < files.length; i++)
        {
            Resource resource = getResource(files[i]);

            builder.processModule(resolver, resource);
        }

        builder.processModules(resolver);
View Full Code Here

    protected Location fabricateLocation(int line)
    {
        String path = "/" + getClass().getName().replace('.', '/');

        Resource r = new ClasspathResource(new DefaultClassResolver(), path);

        return new LocationImpl(r, line);
    }
View Full Code Here

        for (Iterator i = subModules.iterator(); i.hasNext();)
        {
            SubModuleDescriptor smd = (SubModuleDescriptor) i.next();

            Resource descriptorResource = smd.getDescriptor();

            if (descriptorResource.getResourceURL() == null)
            {
                _errorHandler.error(
                        LOG,
                        XmlImplMessages.subModuleDoesNotExist(descriptorResource),
                        smd.getLocation(),
View Full Code Here

     */
    protected Location createModuleLocation(Class moduleClass)
    {
        String path = "/" + moduleClass.getName().replace('.', '/');

        Resource r = new ClasspathResource(_classResolver, path);

        return new AnnotatedModuleLocation(r, moduleClass);
    }
View Full Code Here

    public void testExisting()
        throws Exception
    {
        String path = getFrameworkPath(BASEFILE);

        Resource r = new FileResource(path);

        File file = new File(path);
        URL expected = file.toURL();

        assertEquals(expected, r.getResourceURL());
    }
View Full Code Here

    public void testMissing()
        throws Exception
    {
        String path = "file-does-not-exist.xml";

        Resource r = new FileResource(path);

        assertEquals(null, r.getResourceURL());
    }
View Full Code Here

    public void testCreateWithLocale()
        throws Exception
    {
        String path = getFrameworkPath(DIR + "/localizable_fr.properties");

        Resource r = new FileResource(path, Locale.CANADA_FRENCH);

        assertEquals(path, r.getPath());
        assertEquals(Locale.CANADA_FRENCH, r.getLocale());
    }
View Full Code Here

    public void testGetLocalization()
    {
        String path = getFrameworkPath(BASEFILE);

        Resource base = new FileResource(path);
        Resource localized = base.getLocalization(Locale.FRANCE);

        String expected = getFrameworkPath(DIR + "/localizable_fr.properties");

        assertEquals(expected, localized.getPath());
    }
View Full Code Here

    public void testLocalizationMissing()
    {
        String path = getFrameworkPath(BASEFILE);

        Resource base = new FileResource(path);
        Resource localized = base.getLocalization(Locale.CHINA);

        assertSame(base, localized);
    }
View Full Code Here

TOP

Related Classes of org.apache.hivemind.Resource

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.