use of org.opengrok.indexer.analysis.AnalyzerFactory in project OpenGrok by OpenGrok.
the class ZipAnalyzerFactoryTest method testZipWrtAnalyzerGuru.
/**
* Tests a ZIP file.
* @throws IOException I/O exception
*/
@Test
public void testZipWrtAnalyzerGuru() throws IOException {
InputStream res = getClass().getClassLoader().getResourceAsStream("analysis/archive/zip.bin");
assertNotNull(res, "zip.bin should be available,");
// assert that it is matched
AnalyzerFactory fac = AnalyzerGuru.find(res);
assertNotNull(fac, "zip.bin should have factory");
assertSame(fac.getClass(), ZipAnalyzerFactory.class, "should be ZipAnalyzerFactory");
}
use of org.opengrok.indexer.analysis.AnalyzerFactory in project OpenGrok by OpenGrok.
the class JarAnalyzerFactoryTest method testJarWrtAnalyzerGuru.
/**
* Tests a JAR file.
* @throws IOException
*/
@Test
public void testJarWrtAnalyzerGuru() throws IOException {
InputStream res = getClass().getClassLoader().getResourceAsStream("analysis/executables/javajar.bin");
assertNotNull(res, "javajar.bin should be available,");
// assert that it is matched
AnalyzerFactory fac = AnalyzerGuru.find(res);
assertNotNull(fac, "javajar.bin should have factory");
assertSame(fac.getClass(), JarAnalyzerFactory.class, "should be JarAnalyzerFactory");
}
use of org.opengrok.indexer.analysis.AnalyzerFactory in project OpenGrok by OpenGrok.
the class JavaClassAnalyzerFactoryTest method testJavaClassWrtAnalyzerGuru.
/**
* Tests a Java .class file.
* @throws IOException I/O exception
*/
@Test
public void testJavaClassWrtAnalyzerGuru() throws IOException {
InputStream res = getClass().getClassLoader().getResourceAsStream("analysis/executables/javaclass.bin");
assertNotNull(res, "despite inclusion locally,");
// assert that it is matched
AnalyzerFactory fac = AnalyzerGuru.find(res);
assertNotNull(fac, "javaclass.bin should have factory");
assertSame(fac.getClass(), JavaClassAnalyzerFactory.class, "should be JavaClassAnalyzerFactory");
}
use of org.opengrok.indexer.analysis.AnalyzerFactory in project OpenGrok by OpenGrok.
the class DocumentMatcherTest method testMandocBOMDocument.
/**
* Tests a fake UTF-16LE mandoc(5)-style document to affirm that encoding
* determination is valid.
* @throws IOException I/O exception
*/
@Test
public void testMandocBOMDocument() throws IOException {
InputStream res = getClass().getClassLoader().getResourceAsStream("analysis/document/utf16le.1m");
assertNotNull(res, "despite inclusion locally,");
byte[] buf = readSignature(res);
AnalyzerFactory fac;
// assert that it is mandoc-like
fac = MandocAnalyzerFactory.MATCHER.isMagic(buf, res);
assertNotNull(fac, "though utf16le.1m is mandoc(5),");
assertSame(MandocAnalyzerFactory.DEFAULT_INSTANCE, fac, "though utf16le.1m is mandoc(5)");
}
use of org.opengrok.indexer.analysis.AnalyzerFactory in project OpenGrok by OpenGrok.
the class DocumentMatcherTest method testMdocDocument.
/**
* Tests a mdoc(5)-style document.
* @throws IOException I/O exception
*/
@Test
public void testMdocDocument() throws IOException {
InputStream res = getClass().getClassLoader().getResourceAsStream("analysis/document/sync.1m");
assertNotNull(res, "despite inclusion locally,");
byte[] buf = readSignature(res);
AnalyzerFactory fac;
// assert that it is troff-like
fac = TroffAnalyzerFactory.MATCHER.isMagic(buf, res);
assertNotNull(fac, "though sync.1m is mdoc(5),");
assertSame(TroffAnalyzerFactory.DEFAULT_INSTANCE, fac, "though sync.1m is troff-like mdoc(5)");
// assert that it is not mandoc
fac = MandocAnalyzerFactory.MATCHER.isMagic(buf, res);
assertNull(fac, "though sync.1m is troff-like mdoc(5),");
}
Aggregations