Package org.apache.hivemind

Examples of org.apache.hivemind.Resource


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

        Resource r = new FileResource(path);

        assertEquals(path, r.toString());
    }
View Full Code Here


    {
        String path = getFrameworkPath(DIR);
        // Remove the ./ at the beginning to remove any dot from the path
        if (path.startsWith("./")) path = path.substring(2);

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

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

   
    private static Location createLocation()
    {
        String path = "/" + SimpleModule.class.getName().replace('.', '/');

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

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

        push(elementName, smd, STATE_NO_CONTENT);

        checkAttributes();

        Resource descriptor = getResource().getRelativeResource(getAttribute("descriptor"));

        smd.setDescriptor(descriptor);

        md.addSubModule(smd);
    }
View Full Code Here

        }
    }

    public void testParseExceptionWithLocation() throws Exception
    {
        Resource r = getResource("MethodSubject.class");
        Location l = new LocationImpl(r, 3);

        MethodSubject s = new MethodSubject();
        s.setLocation(l);
View Full Code Here

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

        Resource r = new ClasspathResource(getClassResolver(), "/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

    public Messages getMessages()
    {
        String projectRoot = System.getProperty("PROJECT_ROOT", ".");
        String path = projectRoot + "/examples/src/descriptor/META-INF/panorama.startup.xml";

        Resource r = new FileResource(path);
        MessageFinder mf = new MessageFinderImpl(r);
        ThreadLocale tl = new ThreadLocaleImpl(Locale.getDefault());

        return new ModuleMessages(mf, tl);
    }
View Full Code Here

        ClassResolver resolver = new DefaultClassResolver();

        List descriptorResources = new ArrayList();
        for (int i = 0; i < files.length; i++)
        {
            Resource resource = getResource(files[i]);
            descriptorResources.add(resource);
        }

        ModuleDescriptorProvider provider = new XmlModuleDescriptorProvider(resolver,
                descriptorResources);
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 = getFrameworkPath(DIR + "/does-not-exist");

        Resource r = new FileResource(path);

        assertEquals(null, r.getResourceURL());
    }
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.