Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jandexHackTest.java
package it.flower;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jboss.jandex.Indexer;
import org.jboss.jandex.JarIndexer;
import org.jboss.jandex.Main;
import org.junit.Test;
public class FlowerTest
{
@Test
public void test()
{
String[] libs = new String[] {
"/home/fiorenzo/.m2/repository/javax/enterprise/cdi-api/1.0-SP4/cdi-api-1.0-SP4.jar",
"/home/fiorenzo/.m2/repository/org/jboss/spec/javax/interceptor/jboss-interceptors-api_1.1_spec/1.0.1.Final/jboss-interceptors-api_1.1_spec-1.0.1.Final.jar",
"/home/fiorenzo/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar",
"/home/fiorenzo/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar",
"/home/fiorenzo/.m2/repository/org/hibernate/hibernate-entitymanager/4.1.1.Final/hibernate-entitymanager-4.1.1.Final.jar",
"/home/fiorenzo/.m2/repository/org/hibernate/hibernate-core/4.1.1.Final/hibernate-core-4.1.1.Final.jar",
"/home/fiorenzo/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.1_spec/1.0.1.Final/jboss-transaction-api_1.1_spec-1.0.1.Final.jar",
"/home/fiorenzo/.m2/repository/org/javassist/javassist/3.15.0-GA/javassist-3.15.0-GA.jar",
"/home/fiorenzo/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.1.Final/hibernate-commons-annotations-4.0.1.Final.jar",
"/home/fiorenzo/.m2/repository/org/jboss/logging/jboss-logging/3.0.0.Beta4/jboss-logging-3.0.0.Beta4.jar",
"/home/fiorenzo/.m2/repository/org/jboss/spec/javax/ejb/jboss-ejb-api_3.1_spec/1.0.2.Final/jboss-ejb-api_3.1_spec-1.0.2.Final.jar",
"/home/fiorenzo/.m2/repository/org/jboss/ejb3/jboss-ejb3-ext-api/1.1.1/jboss-ejb3-ext-api-1.1.1.jar",
"/home/fiorenzo/.m2/repository/org/jboss/javaee/jboss-ejb-api/3.0.0.CR1/jboss-ejb-api-3.0.0.CR1.jar",
"/home/fiorenzo/.m2/repository/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1.jar",
"/home/fiorenzo/.m2/repository/jboss/jbossws/jboss-jaxrpc/1.0.4.GA/jboss-jaxrpc-1.0.4.GA.jar",
"/home/fiorenzo/.m2/repository/org/jboss/metadata/jboss-metadata/1.0.0.CR16/jboss-metadata-1.0.0.CR16.jar",
"/home/fiorenzo/.m2/repository/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar",
"/home/fiorenzo/.m2/repository/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA.jar",
"/home/fiorenzo/.m2/repository/org/jboss/javaee/jboss-jms-api/1.1.0.GA/jboss-jms-api-1.1.0.GA.jar",
"/home/fiorenzo/.m2/repository/org/jboss/ws/jbossws-spi/1.0.6.GA/jbossws-spi-1.0.6.GA.jar",
"/home/fiorenzo/.m2/repository/org/apache/ant/ant/1.7.0/ant-1.7.0.jar",
"/home/fiorenzo/.m2/repository/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar",
"/home/fiorenzo/.m2/repository/gnu-getopt/getopt/1.0.13/getopt-1.0.13.jar",
"/home/fiorenzo/.m2/repository/jboss/jbossws/jboss-jaxws/3.0.1-native-2.0.4.GA/jboss-jaxws-3.0.1-native-2.0.4.GA.jar",
"/home/fiorenzo/.m2/repository/org/jboss/jbossxb/2.0.0.GA/jbossxb-2.0.0.GA.jar",
"/home/fiorenzo/.m2/repository/org/jboss/jboss-reflect/2.0.0.GA/jboss-reflect-2.0.0.GA.jar",
"/home/fiorenzo/.m2/repository/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar",
"/home/fiorenzo/.m2/repository/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar",
"/home/fiorenzo/.m2/repository/org/jboss/jboss-vfs/2.0.0.CR1/jboss-vfs-2.0.0.CR1.jar",
"/home/fiorenzo/.m2/repository/org/jboss/jboss-mdr/2.0.0.GA/jboss-mdr-2.0.0.GA.jar",
"/home/fiorenzo/.m2/repository/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar",
"/home/fiorenzo/.m2/repository/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar",
"/home/fiorenzo/.m2/repository/org/jboss/spec/javax/faces/jboss-jsf-api_2.1_spec/2.0.2.Final/jboss-jsf-api_2.1_spec-2.0.2.Final.jar",
"/home/fiorenzo/.m2/repository/org/jboss/spec/javax/servlet/jboss-servlet-api_3.0_spec/1.0.1.Final/jboss-servlet-api_3.0_spec-1.0.1.Final.jar",
"/home/fiorenzo/.m2/repository/org/primefaces/primefaces/3.4/primefaces-3.4.jar",
"/home/fiorenzo/.m2/repository/it/coopservice/ws/client/ucsmailwsclient/1.0.2-SNAPSHOT/ucsmailwsclient-1.0.2-SNAPSHOT.jar",
"/home/fiorenzo/.m2/repository/org/apache/axis/axis/1.4/axis-1.4.jar",
"/home/fiorenzo/.m2/repository/javax/xml/jaxrpc-api/1.1/jaxrpc-api-1.1.jar",
"/home/fiorenzo/.m2/repository/it/coopservice/rest/client/ucs-locker-rest-client/0.0.3/ucs-locker-rest-client-0.0.3.jar",
"/home/fiorenzo/.m2/repository/it/coopservice/ws/client/ldapwsclient/1.2.0/ldapwsclient-1.2.0.jar",
"/home/fiorenzo/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar",
"/home/fiorenzo/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar",
"/home/fiorenzo/.m2/repository/org/apache/pdfbox/pdfbox/1.6.0/pdfbox-1.6.0.jar",
"/home/fiorenzo/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar",
"/home/fiorenzo/.m2/repository/org/apache/pdfbox/jempbox/1.6.0/jempbox-1.6.0.jar",
"/home/fiorenzo/.m2/repository/org/apache/pdfbox/fontbox/1.6.0/fontbox-1.6.0.jar",
"/home/fiorenzo/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/2.3.0.GA/resteasy-jaxrs-2.3.0.GA.jar",
"/home/fiorenzo/.m2/repository/org/jboss/resteasy/jaxrs-api/2.3.0.GA/jaxrs-api-2.3.0.GA.jar",
"/home/fiorenzo/.m2/repository/org/scannotation/scannotation/1.0.3/scannotation-1.0.3.jar",
"/home/fiorenzo/.m2/repository/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar",
"/home/fiorenzo/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar",
"/home/fiorenzo/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar",
"/home/fiorenzo/.m2/repository/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2.jar",
"/home/fiorenzo/.m2/repository/org/apache/httpcomponents/httpcore/4.1.2/httpcore-4.1.2.jar",
"/home/fiorenzo/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar",
"/home/fiorenzo/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/2.3.0.GA/resteasy-multipart-provider-2.3.0.GA.jar",
"/home/fiorenzo/.m2/repository/javax/mail/mail/1.4.4/mail-1.4.4.jar",
"/home/fiorenzo/.m2/repository/org/apache/james/apache-mime4j/0.6/apache-mime4j-0.6.jar",
"/home/fiorenzo/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/2.3.0.GA/resteasy-jaxb-provider-2.3.0.GA.jar",
"/home/fiorenzo/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.4/jaxb-impl-2.2.4.jar",
"/home/fiorenzo/.m2/repository/javax/xml/bind/jaxb-api/2.2.3/jaxb-api-2.2.3.jar",
"/home/fiorenzo/.m2/repository/com/sun/xml/stream/sjsxp/1.0.1/sjsxp-1.0.1.jar",
"/home/fiorenzo/.m2/repository/javax/xml/stream/stax-api/1.0/stax-api-1.0.jar",
"/home/fiorenzo/.m2/repository/net/sourceforge/jexcelapi/jxl/2.6.10/jxl-2.6.10.jar",
"/home/fiorenzo/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar",
"/home/fiorenzo/.m2/repository/junit/junit/4.8.2/junit-4.8.2.jar"
};
List<String> result = new ArrayList<String>();
long start = System.currentTimeMillis();
for (String lib : libs)
{
File source = new File(
lib);
Indexer indexer = new Indexer();
try
{
result.addAll(JarIndexer.createFlowerIndex(source, indexer));
}
catch (IOException e)
{
e.printStackTrace();
}
}
long stop = System.currentTimeMillis();
assert (stop - start < 1500);
assert (result.size() > 15000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.