Package org.apache.hivemind.util

Examples of org.apache.hivemind.util.ClasspathResource


    protected Resource getSpecificationResourceLocation(String simpleName)
    {
        String adjustedClassName = "/" + getClass().getName().replace('.', '/') + ".class";

        Resource classResource = new ClasspathResource(_resolver, adjustedClassName);

        return classResource.getRelativeResource(simpleName);
    }
View Full Code Here


    private static final String MOCK1 = "/org/apache/tapestry/junit/MockPage1.page";

    private IComponentSpecification newSpec(String path)
    {
        Resource resource = new ClasspathResource(new DefaultClassResolver(), path);

        IComponentSpecification spec = new ComponentSpecification();
        spec.setSpecificationLocation(resource);

        return spec;
View Full Code Here

        return spec;
    }

    private ILibrarySpecification newLibrarySpec()
    {
        Resource resource = new ClasspathResource(new DefaultClassResolver(),
                "/org/apache/tapestry/junit/Library.library");

        ILibrarySpecification spec = new LibrarySpecification();
        spec.setSpecificationLocation(resource);
View Full Code Here

    private ClassResolver _resolver = new DefaultClassResolver();

    private ScriptDescriptor parse(String file) throws Exception
    {
        String basePath = "/" + getClass().getName().replace('.', '/');
        Resource baseResource = new ClasspathResource(_resolver, basePath);

        Resource fileResource = baseResource.getRelativeResource(file);

        return new IntegrationTestScriptParser().parse(fileResource);
    }
View Full Code Here

{
    public void testOnClasspath() throws Exception
    {
        DefaultClassResolver cr = new DefaultClassResolver();

        Resource appSpecResource = new ClasspathResource(cr, "/foo/OnClasspath.application");

        ApplicationSpecificationInitializer i = new ApplicationSpecificationInitializer();

        Log log = (Log) newMock(Log.class);

        i.setLog(log);

        ClasspathResourceFactoryImpl cf = new ClasspathResourceFactoryImpl();
        cf.setClassResolver(cr);

        i.setClasspathResourceFactory(cf);

        HttpServlet servlet = new ServletFixture();

        MockControl configControl = newControl(ServletConfig.class);
        ServletConfig config = (ServletConfig) configControl.getMock();

        trainForServletInit(configControl, config);

        config.getInitParameter(ApplicationSpecificationInitializer.APP_SPEC_PATH_PARAM);
        configControl.setReturnValue(appSpecResource.getPath());

        IApplicationSpecification as = new ApplicationSpecification();

        MockControl parserControl = newControl(ISpecificationParser.class);
        ISpecificationParser parser = (ISpecificationParser) parserControl.getMock();
View Full Code Here

        ClasspathResourceFactoryImpl f = new ClasspathResourceFactoryImpl();
        f.setClassResolver(cr);

        String path = "/foo/bar";

        ClasspathResource expected = new ClasspathResource(cr, path);

        assertEquals(expected, f.newResource(path));
    }
View Full Code Here

                "tapestry.ClasspathResourceFactory",
                ClasspathResourceFactory.class);

        String path = "/foo/bar";

        ClasspathResource expected = new ClasspathResource(cr, path);

        assertEquals(expected, f.newResource(path));
    }
View Full Code Here

    Resource getScript(IComponent component)
    {
        if (IWidget.class.isInstance(component)) {

            if (_widgetResource == null)
                _widgetResource = new ClasspathResource(_resolver, _widgetScript);

            return _widgetResource;
        }

        if (_componentResource == null)
            _componentResource = new ClasspathResource(_resolver, _componentScript);

        return _componentResource;
    }
View Full Code Here

    }

    Resource getElementScript()
    {
        if (_elementResource == null)
            _elementResource = new ClasspathResource(_resolver, _elementScript);

        return _elementResource;
    }
View Full Code Here

        factory.setAssetService(assetService);
        factory.setLocalizer(new DefaultResourceLocalizer());
       
        String path = "/org/apache/tapestry/html/dojo";
       
        Resource subResource = new ClasspathResource(getClassResolver(), path);
        IAsset asset = factory.createAsset(subResource, l);
       
        assertTrue(asset instanceof PrivateAsset);
        assertEquals(path, asset
                .getResourceLocation().getPath());
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.