use of org.testng.SkipException in project selenium-tests by Wikia.
the class PageObjectLogging method onTestSkipped.
@Override
public void onTestSkipped(ITestResult result) {
if (!testStarted) {
start(result.getMethod().getConstructorOrMethod().getMethod());
}
if (result.getMethod().getConstructorOrMethod().getMethod().isAnnotationPresent(DontRun.class)) {
log("Test SKIPPED", "this test is not supported in this environment", true);
result.setStatus(ITestResult.SUCCESS);
onTestSuccess(result);
} else {
result.setStatus(ITestResult.FAILURE);
result.setThrowable(new SkipException("TEST SKIPPED"));
onTestFailure(result);
}
if (testStarted) {
stopLogging();
}
}
use of org.testng.SkipException in project gatk by broadinstitute.
the class IntelInflaterDeflaterIntegrationTest method deflateInflateWithIntel.
@Test
public void deflateInflateWithIntel() throws DataFormatException {
if (!isIntelInflaterDeflaterSupported()) {
throw new SkipException("IntelInflater/IntelDeflater not available on this platform");
}
// create buffers and random input
final int LEN = 64 * 1024;
final byte[] input = new RandomDNA().nextBases(LEN);
final byte[] compressed = new byte[2 * LEN];
final byte[] result = new byte[LEN];
final IntelInflaterFactory intelInflaterFactory = new IntelInflaterFactory();
final IntelDeflaterFactory intelDeflaterFactory = new IntelDeflaterFactory();
Assert.assertTrue(intelInflaterFactory.usingIntelInflater());
Assert.assertTrue(intelDeflaterFactory.usingIntelDeflater());
for (int i = 0; i < 10; i++) {
// create deflater with compression level i
final Deflater deflater = intelDeflaterFactory.makeDeflater(i, true);
// setup deflater
deflater.setInput(input);
deflater.finish();
// compress data
int compressedBytes = 0;
// so this loop should always finish in one iteration
while (!deflater.finished()) {
compressedBytes = deflater.deflate(compressed, 0, compressed.length);
}
deflater.end();
// decompress and check output == input
Inflater inflater = intelInflaterFactory.makeInflater(true);
inflater.setInput(compressed, 0, compressedBytes);
inflater.inflate(result);
inflater.end();
Assert.assertEquals(input, result);
// clear compressed and result buffers for next iteration
Arrays.fill(compressed, (byte) 0);
Arrays.fill(result, (byte) 0);
}
}
use of org.testng.SkipException in project gatk by broadinstitute.
the class IntelInflaterDeflaterIntegrationTest method testIntelInflaterDeflaterWithPrintReads.
@Test(dataProvider = "JdkFlags")
public void testIntelInflaterDeflaterWithPrintReads(final boolean use_jdk_inflater, final boolean use_jdk_deflater) throws Exception {
if (!isIntelInflaterDeflaterSupported()) {
throw new SkipException("IntelInflater/IntelDeflater not available on this platform");
}
final File ORIG_BAM = new File(largeFileTestDir, INPUT_FILE);
final File outFile = BaseTest.createTempFile(INPUT_FILE, ".bam");
final ArrayList<String> args = new ArrayList<>();
args.add("--input");
args.add(ORIG_BAM.getAbsolutePath());
args.add("--output");
args.add(outFile.getAbsolutePath());
args.add("--use_jdk_inflater");
args.add(String.valueOf(use_jdk_inflater));
args.add("--use_jdk_deflater");
args.add(String.valueOf(use_jdk_deflater));
// store current default factories, so they can be restored later
InflaterFactory currentInflaterFactory = BlockGunzipper.getDefaultInflaterFactory();
DeflaterFactory currentDeflaterFactory = BlockCompressedOutputStream.getDefaultDeflaterFactory();
// set default factories to jdk version
// because PrintReads cannot change the factory to Jdk if it was already set to Intel
BlockGunzipper.setDefaultInflaterFactory(new InflaterFactory());
BlockCompressedOutputStream.setDefaultDeflaterFactory(new DeflaterFactory());
// run PrintReads
runCommandLine(args);
// restore default factories
BlockGunzipper.setDefaultInflaterFactory(currentInflaterFactory);
BlockCompressedOutputStream.setDefaultDeflaterFactory(currentDeflaterFactory);
// validate input and output files are the same
SamAssertionUtils.assertSamsEqual(outFile, ORIG_BAM);
}
use of org.testng.SkipException in project gatk by broadinstitute.
the class AlleleListUnitTester method alleleList.
/**
* Generate testing alleles.
*
* <p>
* Basically all are random alleles given the maximum allele length.
* </p>
*
* <p>
* So with a low max-allele-length and high allele-count you can force repeats.
* </p>
*
* @param alleleCount number of alleles to generate.
* @param maxAlleleLength the maximum length of the allele in bases.
* @param skipIfRepeats throw an test-skip exception {@link SkipException} if the resulting allele-list
* has repeats, thus is size is less than {@code alleleCount}
*
* @throws RuntimeException if {@code alleleCount} is negative or {@code maxAlleleLength} is less than 1.
* @return never {@code null}.
*/
public static AlleleList<Allele> alleleList(final int alleleCount, final int maxAlleleLength, final boolean skipIfRepeats) {
final Allele[] alleles = AlleleListUnitTester.generateRandomUniqueAlleles(alleleCount, maxAlleleLength);
if (alleleCount > 0)
alleles[0] = Allele.create(alleles[0].getBases(), true);
final AlleleList<Allele> alleleList = new IndexedAlleleList<>(alleles);
if (skipIfRepeats && alleleList.numberOfAlleles() != alleles.length)
throw new SkipException("repeated alleles, should be infrequent");
return alleleList;
}
Aggregations