Search in sources :

Example 1 with AnnotationRepository

use of org.jboss.jca.common.spi.annotations.repository.AnnotationRepository in project wildfly by wildfly.

the class AnnotationsTestCase method testProcessConnectionDefinitions.

/**
     * Process: ConnectionDefinitions -- verification of the
     * processConnectionDefinitions method
     *
     * @throws Throwable throwable exception
     */
@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());
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) Indexer(org.jboss.jandex.Indexer) InputStream(java.io.InputStream) SuffixMatchFilter(org.jboss.vfs.util.SuffixMatchFilter) AnnotationRepository(org.jboss.jca.common.spi.annotations.repository.AnnotationRepository) Index(org.jboss.jandex.Index) URI(java.net.URI) Test(org.junit.Test)

Example 2 with AnnotationRepository

use of org.jboss.jca.common.spi.annotations.repository.AnnotationRepository in project wildfly by wildfly.

the class AnnotationsTestCase method testProcessConnectorFail.

/**
     * Process: Connector -- verification of the processConnector method
     *
     * @throws Throwable throwable exception
     */
@Test
public void testProcessConnectorFail() throws Throwable {
    try {
        URI uri = getURI("/rafail2connector.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());
        fail("Success");
    } catch (Throwable t) {
    // Ok
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) Indexer(org.jboss.jandex.Indexer) InputStream(java.io.InputStream) SuffixMatchFilter(org.jboss.vfs.util.SuffixMatchFilter) AnnotationRepository(org.jboss.jca.common.spi.annotations.repository.AnnotationRepository) Index(org.jboss.jandex.Index) URI(java.net.URI) Test(org.junit.Test)

Example 3 with AnnotationRepository

use of org.jboss.jca.common.spi.annotations.repository.AnnotationRepository in project wildfly by wildfly.

the class AnnotationsTestCase method testProcessActivation.

/**
     * Process: Activation -- verification of the processActivation method
     *
     * @throws Throwable throwable exception
     */
@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());
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) Indexer(org.jboss.jandex.Indexer) InputStream(java.io.InputStream) SuffixMatchFilter(org.jboss.vfs.util.SuffixMatchFilter) AnnotationRepository(org.jboss.jca.common.spi.annotations.repository.AnnotationRepository) Index(org.jboss.jandex.Index) URI(java.net.URI) Test(org.junit.Test)

Example 4 with AnnotationRepository

use of org.jboss.jca.common.spi.annotations.repository.AnnotationRepository in project wildfly by wildfly.

the class AnnotationsTestCase method testProcessConfigProperty.

/**
     * Process: ConfigProperty -- verification of the processConfigProperty
     * method
     *
     * @throws Throwable throwable exception
     */
@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());
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) Indexer(org.jboss.jandex.Indexer) InputStream(java.io.InputStream) SuffixMatchFilter(org.jboss.vfs.util.SuffixMatchFilter) AnnotationRepository(org.jboss.jca.common.spi.annotations.repository.AnnotationRepository) Index(org.jboss.jandex.Index) URI(java.net.URI) Test(org.junit.Test)

Example 5 with AnnotationRepository

use of org.jboss.jca.common.spi.annotations.repository.AnnotationRepository in project wildfly by wildfly.

the class AnnotationsTestCase method testProcessConnectionDefinition.

/**
     * Process: ConnectionDefinition -- verification of the
     * processConnectionDefinition method
     *
     * @throws Throwable throwable exception
     */
@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());
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) Indexer(org.jboss.jandex.Indexer) InputStream(java.io.InputStream) SuffixMatchFilter(org.jboss.vfs.util.SuffixMatchFilter) AnnotationRepository(org.jboss.jca.common.spi.annotations.repository.AnnotationRepository) Index(org.jboss.jandex.Index) URI(java.net.URI) Test(org.junit.Test)

Aggregations

Index (org.jboss.jandex.Index)13 AnnotationRepository (org.jboss.jca.common.spi.annotations.repository.AnnotationRepository)13 InputStream (java.io.InputStream)11 URI (java.net.URI)11 Indexer (org.jboss.jandex.Indexer)11 VirtualFile (org.jboss.vfs.VirtualFile)11 SuffixMatchFilter (org.jboss.vfs.util.SuffixMatchFilter)11 Test (org.junit.Test)10 File (java.io.File)4 Annotation (org.jboss.jca.common.spi.annotations.repository.Annotation)4 JandexAnnotationRepositoryImpl (org.jboss.as.connector.annotations.repository.jandex.JandexAnnotationRepositoryImpl)2 ResourceAdapterDeployment (org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment)2 ResourceAdapterDeploymentService (org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterDeploymentService)2 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)2 Annotations (org.jboss.jca.common.annotations.Annotations)2 TransactionSupportEnum (org.jboss.jca.common.api.metadata.common.TransactionSupportEnum)2 Activation (org.jboss.jca.common.api.metadata.resourceadapter.Activation)2 Connector (org.jboss.jca.common.api.metadata.spec.Connector)2 Merger (org.jboss.jca.common.metadata.merge.Merger)2 ServiceName (org.jboss.msc.service.ServiceName)2