Package org.jboss.jandex

Examples of org.jboss.jandex.Indexer


    @Test
    public void testProcessConnectionDefinitions() throws Throwable {
        try {
            URI uri = getURI("/ra16annoconndefs.rar");
            final VirtualFile virtualFile = VFS.getChild(uri);
            final Indexer indexer = new Indexer();
            final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class",
                    VisitorAttributes.RECURSE_LEAVES_ONLY));
            for (VirtualFile classFile : classChildren) {
                InputStream inputStream = null;
                try {
                    inputStream = classFile.openStream();
                    indexer.index(inputStream);
                } finally {
                    VFSUtils.safeClose(inputStream);
                }
            }
            final Index index = indexer.complete();
            AnnotationRepository ar = new JandexAnnotationRepositoryImpl(index, Thread.currentThread().getContextClassLoader());
            annotations.process(ar, null, Thread.currentThread().getContextClassLoader());
        } catch (Throwable t) {
            t.printStackTrace();
            fail(t.getMessage());
View Full Code Here


    @Test
    public void testProcessConnectionDefinition() throws Throwable {
        try {
            URI uri = getURI("/ra16annoconndef.rar");
            final VirtualFile virtualFile = VFS.getChild(uri);
            final Indexer indexer = new Indexer();
            final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class",
                    VisitorAttributes.RECURSE_LEAVES_ONLY));
            for (VirtualFile classFile : classChildren) {
                InputStream inputStream = null;
                try {
                    inputStream = classFile.openStream();
                    indexer.index(inputStream);
                } finally {
                    VFSUtils.safeClose(inputStream);
                }
            }
            final Index index = indexer.complete();
            AnnotationRepository ar = new JandexAnnotationRepositoryImpl(index, Thread.currentThread().getContextClassLoader());
            annotations.process(ar, null, Thread.currentThread().getContextClassLoader());
        } catch (Throwable t) {
            fail(t.getMessage());
        }
View Full Code Here

    @Test
    public void testProcessActivation() throws Throwable {
        try {
            URI uri = getURI("/ra16annoactiv.rar");
            final VirtualFile virtualFile = VFS.getChild(uri);
            final Indexer indexer = new Indexer();
            final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class",
                    VisitorAttributes.RECURSE_LEAVES_ONLY));
            for (VirtualFile classFile : classChildren) {
                InputStream inputStream = null;
                try {
                    inputStream = classFile.openStream();
                    indexer.index(inputStream);
                } finally {
                    VFSUtils.safeClose(inputStream);
                }
            }
            final Index index = indexer.complete();
            AnnotationRepository ar = new JandexAnnotationRepositoryImpl(index, Thread.currentThread().getContextClassLoader());
            annotations.process(ar, null, Thread.currentThread().getContextClassLoader());
        } catch (Throwable t) {
            fail(t.getMessage());
        }
View Full Code Here

    @Test
    public void testProcessAuthenticationMechanism() throws Throwable {
        try {
            URI uri = getURI("/ra16annoauthmech.rar");
            final VirtualFile virtualFile = VFS.getChild(uri);
            final Indexer indexer = new Indexer();
            final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class",
                    VisitorAttributes.RECURSE_LEAVES_ONLY));
            for (VirtualFile classFile : classChildren) {
                InputStream inputStream = null;
                try {
                    inputStream = classFile.openStream();
                    indexer.index(inputStream);
                } finally {
                    VFSUtils.safeClose(inputStream);
                }
            }
            final Index index = indexer.complete();
            AnnotationRepository ar = new JandexAnnotationRepositoryImpl(index, Thread.currentThread().getContextClassLoader());
            annotations.process(ar, null, Thread.currentThread().getContextClassLoader());
        } catch (Throwable t) {
            fail(t.getMessage());
        }
View Full Code Here

    @Test
    public void testProcessAdministeredObject() throws Throwable {
        try {
            URI uri = getURI("/ra16annoadminobj.rar");
            final VirtualFile virtualFile = VFS.getChild(uri);
            final Indexer indexer = new Indexer();
            final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class",
                    VisitorAttributes.RECURSE_LEAVES_ONLY));
            for (VirtualFile classFile : classChildren) {
                InputStream inputStream = null;
                try {
                    inputStream = classFile.openStream();
                    indexer.index(inputStream);
                } finally {
                    VFSUtils.safeClose(inputStream);
                }
            }
            final Index index = indexer.complete();
            AnnotationRepository ar = new JandexAnnotationRepositoryImpl(index, Thread.currentThread().getContextClassLoader());
            annotations.process(ar, null, Thread.currentThread().getContextClassLoader());
        } catch (Throwable t) {
            fail(t.getMessage());
        }
View Full Code Here

    @Test
    public void testProcessConfigProperty() throws Throwable {
        try {
            URI uri = getURI("/ra16annoconfprop.rar");
            final VirtualFile virtualFile = VFS.getChild(uri);
            final Indexer indexer = new Indexer();
            final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class",
                    VisitorAttributes.RECURSE_LEAVES_ONLY));
            for (VirtualFile classFile : classChildren) {
                InputStream inputStream = null;
                try {
                    inputStream = classFile.openStream();
                    indexer.index(inputStream);
                } finally {
                    VFSUtils.safeClose(inputStream);
                }
            }
            final Index index = indexer.complete();
            AnnotationRepository ar = new JandexAnnotationRepositoryImpl(index, Thread.currentThread().getContextClassLoader());
            annotations.process(ar, null, Thread.currentThread().getContextClassLoader());
        } catch (Throwable t) {
            fail(t.getMessage());
        }
View Full Code Here

        JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "webTest.jar");
        jar.addClasses(ModuleServlet.class);


        Indexer indexer = new Indexer();
        try (final InputStream resource = ModuleServlet.class.getResourceAsStream(ModuleServlet.class.getSimpleName() + ".class")) {
            indexer.index(resource);
        }
        Index index = indexer.complete();
        ByteArrayOutputStream data = new ByteArrayOutputStream();
        IndexWriter writer = new IndexWriter(data);
        writer.write(index);
        jar.addAsManifestResource(new ByteArrayAsset(data.toByteArray()), "jandex.idx");
        FileOutputStream jarFile = new FileOutputStream(new File(file, "webTest.jar"));
View Full Code Here

class IndexUtils {

    static CompositeIndex createIndex(Object... resources) throws IOException {
        final ClassLoader classLoader = IndexUtils.class.getClassLoader();
        final Indexer indexer = new Indexer();
        for (Object resource : resources) {
            addResource(resource, indexer, classLoader);
        }
        final Index index = indexer.complete();
        return new CompositeIndex(Collections.singleton(index));
    }
View Full Code Here

        JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "weldTest.jar");
        jar.addClasses(SimpleBean.class, ModuleEjb.class);
        jar.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");


        Indexer indexer = new Indexer();
        try (final InputStream resource = ModuleEjb.class.getResourceAsStream(ModuleEjb.class.getSimpleName() + ".class")) {
            indexer.index(resource);
        }
        Index index = indexer.complete();
        ByteArrayOutputStream data = new ByteArrayOutputStream();
        IndexWriter writer = new IndexWriter(data);
        writer.write(index);
        jar.addAsManifestResource(new ByteArrayAsset(data.toByteArray()), "jandex.idx");
        FileOutputStream jarFile = new FileOutputStream(new File(file, "weldTest.jar"));
View Full Code Here

            jar.addClasses(GlobalModuleEjb.class, GlobalModuleInterceptor.class);

            final ClassLoader cl = GlobalModulesTestCase.class.getClassLoader();

            //create annotation index
            Indexer indexer = new Indexer();
            indexer.index(cl.getResourceAsStream(GlobalModuleEjb.class.getName().replace(".","/") + ".class"));
            indexer.index(cl.getResourceAsStream(GlobalModuleInterceptor.class.getName().replace(".", "/") + ".class"));
            final Index index = indexer.complete();
            final ByteArrayOutputStream out = new ByteArrayOutputStream();
            IndexWriter writer = new IndexWriter(out);
            writer.write(index);
            jar.addAsManifestResource(new ByteArrayAsset(out.toByteArray()), "jandex.idx");
View Full Code Here

TOP

Related Classes of org.jboss.jandex.Indexer

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.