Package org.apache.hivemind

Examples of org.apache.hivemind.Resource


        assertEquals(Visibility.PRIVATE, cpd.getVisibility());
    }

    public void testPrivateSchema() throws Exception
    {
        Resource location = getResource("PrivateSchema.xml");
        DefaultErrorHandler eh = new DefaultErrorHandler();

        XmlResourceProcessor p = new XmlResourceProcessor(_resolver, eh);

        ModuleDescriptor md = p.processResource(location);
View Full Code Here


        runScript(script, mock);
    }

    public void testLinePreciseErrorReporting() throws Exception
    {
        Resource resource = getResource("missingModuleId.groovy");

        ErrorHandler handler = new DefaultErrorHandler();
        DescriptorParser parser = new DescriptorParser(handler);

        parser.initialize(resource, getClassResolver());

        GroovyCodeSource source = new GroovyCodeSource(resource.getResourceURL());

        Script script = new GroovyShell().parse(source);

        try
        {
View Full Code Here

{

    private Element parse(String file) throws Exception
    {
        URL fileURL = getClass().getResource(file);
        Resource r = new URLResource(fileURL);

        ElementAssembler a = new ElementAssembler();

        return a.parse(r);
    }
View Full Code Here

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

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

        builder.processModules(_resolver);
        builder.processModule(_resolver, moduleResource);

        Registry r = (Registry) 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());
View Full Code Here

    public void testParse() throws Exception
    {
        Document d = createDocument();
        SDLDocumentAdaptor adaptor = new SDLDocumentAdaptor(d);

        Resource r = getResource("Sample.sdl");

        adaptor.parse(r);

        Element e = d.getDocumentElement();
        assertEquals("module", e.getTagName());
View Full Code Here

        File module = new File("./examples/src/descriptor/META-INF/panorama.startup.xml");
        if (!module.exists()) {
            module = new File("./src/descriptor/META-INF/panorama.startup.xml");
        }

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

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

        assertEquals(Visibility.PRIVATE, cpd.getVisibility());
    }

    public void testPrivateSchema() throws Exception
    {
        Resource location = getResource("PrivateSchema.xml");
        DefaultErrorHandler eh = new DefaultErrorHandler();

        XmlResourceProcessor p = new XmlResourceProcessor(_resolver, eh);

        ModuleDescriptor md = p.processResource(location);
View Full Code Here

            return;
        }

        String path = file.getPath().replace('\\', '/');

        Resource r = new FileResource(path);

        enqueue(r, definition);
    }
View Full Code Here

   
    private void enqueueJar(File jarFile, RegistryDefinition definition) throws IOException
    {
        URL jarRootURL = new URL("jar:" + jarFile.toURL() + "!/" + HivemoduleProvider.HIVE_MODULE_XML);

        Resource jarResource = new URLResource(jarRootURL);
        enqueue(jarResource, definition);
    }
View Full Code Here

        RegistryBuilder builder = new RegistryBuilder();
        builder.autoDetectModules();

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

            XmlModuleReader reader = new XmlModuleReader(builder.getRegistryDefinition(),
                    resolver, builder.getErrorHandler());
            reader.readModule(resource);
        }
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.