use of org.jboss.jandex.Indexer in project wildfly by wildfly.
the class IndexUtils method createIndex.
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));
}
use of org.jboss.jandex.Indexer 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());
}
}
use of org.jboss.jandex.Indexer 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
}
}
use of org.jboss.jandex.Indexer 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());
}
}
use of org.jboss.jandex.Indexer 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());
}
}
Aggregations