@Test(groups = {"functional"}) public void testInvokedAndSkipped() throws SkipException { // System.out.println("Skipping this test after it is invoked."); throw new SkipException("This test is skipped after invocation"); }
@Override public String getMessage() { if(isSkip()) { return super.getMessage(); } else { return super.getMessage() + "; Test must have been enabled by: " + m_outFormat.format(m_expireDate.getTime()); } }
private boolean isSkipExceptionAndSkip(Throwable ite) { return SkipException.class.isAssignableFrom(ite.getClass()) && ((SkipException) ite).isSkip(); }
@Test(description = "Requirements: 086") public void getRecordsBySubjectWithoutResults() { if (this.recordTopics.isEmpty()) { throw new SkipException( "No dc:subject elements found in sample records."); MediaType.APPLICATION_XML_TYPE); response = this.client.handle(request); Assert.assertEquals(response.getStatus(), ClientResponse.Status.OK.getStatusCode(), ErrorMessage.get(ErrorMessageKeys.UNEXPECTED_STATUS)); Element results = (Element) entity.getElementsByTagNameNS( Namespaces.CSW, "SearchResults").item(0); Assert.assertNotNull(results, ErrorMessage.format( ErrorMessageKeys.MISSING_INFOSET_ITEM, "csw:SearchResults")); Assert.assertEquals(results.getChildNodes().getLength(), 0, ErrorMessage.format(ErrorMessageKeys.RESULT_SET_SIZE, "csw:SummaryRecord"));
@Test public void testCreateWithStagingDirectorySymlink() throws Exception throw new SkipException("Filesystem does not support symlinks", e); FSDataOutputStream stream = fs.create(new Path("s3n://test-bucket/test")); stream.close(); assertTrue(Files.exists(link));
@Test(description = "Requirements: 017; Tests: 017") public void getBriefRecordsByBBOX() { if (null == this.geoExtent) { throw new SkipException( "Could not determine extent of sample data."); MediaType.APPLICATION_XML_TYPE); response = this.client.handle(request); Assert.assertEquals(response.getStatus(), ClientResponse.Status.OK.getStatusCode(), ErrorMessage.get(ErrorMessageKeys.UNEXPECTED_STATUS));
@Test public void testSignGetUrlWithTime() throws InterruptedException, IOException { String name = "hello"; String text = "fooooooooooooooooooooooo"; Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build(); String container = getContainerName(); try { view.getBlobStore().putBlob(container, blob); assertConsistencyAwareContainerSize(container, 1); HttpRequest request = view.getSigner().signGetBlob(container, name, 3 /* seconds */); assertEquals(request.getFilters().size(), 0); assertEquals(Strings2.toString(view.utils().http().invoke(request).getPayload()), text); TimeUnit.SECONDS.sleep(4); try { Strings2.toString(view.utils().http().invoke(request).getPayload()); fail("Temporary URL did not expire as expected"); } catch (AuthorizationException expected) { } } catch (UnsupportedOperationException ignore) { throw new SkipException("signGetUrl with a time limit is not supported on " + provider); } finally { returnContainer(container); } }
@Test(dataProvider = "getVerdic", retryAnalyzer = DataProviderRetryAnalyzer.class) public void test(String verdict) { switch (verdict) { case "FAIL": Assert.fail("This time test FAIL!"); break; case "SKIP": throw new SkipException("This time test SKIPPED!"); default: break; } }
protected void assertAuditEntry(ExportImportAuditService auditService) throws InterruptedException { pauseForIndexCreation(); List<ExportImportAuditEntry> result = null; try { result = auditService.get("", "", "", "", "", 10, 0); } catch (Exception e) { throw new SkipException("audit entries not retrieved."); } assertNotNull(result); assertTrue(result.size() > 0); }
protected void verifyCreatedEntities(AtlasEntityStoreV2 entityStore, String[] entityGuids, int expectedNumberOfEntitiesCreated) { try { AtlasEntity.AtlasEntitiesWithExtInfo entities = entityStore.getByIds(Arrays.asList((String[]) entityGuids)); assertEquals(entities.getEntities().size(), expectedNumberOfEntitiesCreated); } catch (AtlasBaseException e) { throw new SkipException(String.format("getByIds: could not load '%s'", entityGuids.toString())); } }
public static void skipTestIfDockerUnavailable() { try { Assert.assertNotNull(DockerClientFactory.instance().client()); } catch (IllegalStateException e) { throw new SkipException("Docker is not available", e); } } }
protected static void skipTestUnless(boolean requirement) { if (!requirement) { throw new SkipException("requirement not met"); } }
errors.add(new SkipException("Error Publisher not available: " + element)); elementCounts.add(element); errors.add(new SkipException("Error Publisher doesn't support this many elements. Required: " + element + ", Actual: " + elementSupport)); elementCounts.add(element); } else { errors.add(new SkipException("Publisher doesn't support this many elements. Required: " + element + ", Actual: " + elementSupport)); elementCounts.add(element); errors.add(ex); elementCounts.add(element); if (!ex.isSkip()) { hasFailure = true;
@Test(description = "Requirements: 022,023") public void sliceResults() { QName countParam = new QName(Namespaces.OSD11, "count"); continue; // skip if query produces non-XML results Assert.assertEquals(response.getStatus(), ClientResponse.Status.OK.getStatusCode(), ErrorMessage.get(ErrorMessageKeys.UNEXPECTED_STATUS)); Assert.assertTrue(records.getLength() > 0, ErrorMessage.get(ErrorMessageKeys.EMPTY_RESULT_SET)); Document entity = getResponseEntityAsDocument(response, null); Node itemsPerPage = entity.getElementsByTagNameNS( Namespaces.OSD11, "itemsPerPage").item(0); Assert.assertNotNull(itemsPerPage, ErrorMessage.format( ErrorMessageKeys.MISSING_INFOSET_ITEM, "os:itemsPerPage")); break; default: throw new SkipException("Unrecognized namespace: " + namespaceURI);
@Test public void testGATKMasterKeyPairMutualDecryption() { if ( gatkPrivateKeyExistsButReadPermissionDenied() ) { throw new SkipException(String.format("Skipping test %s because we do not have permission to read the GATK private key", "testGATKMasterKeyPairMutualDecryption")); } Assert.assertTrue(CryptUtils.keysDecryptEachOther(CryptUtils.loadGATKMasterPrivateKey(), CryptUtils.loadGATKMasterPublicKey())); }
@Test(dataProvider = "pathMatcherData") public static void nativeMatcherExactTest(@NotNull String pattern, @NotNull String path, @Nullable Boolean ignored, @Nullable Boolean expectedMatch) throws InvalidPatternException, IOException, InterruptedException { Path temp = Files.createTempDirectory("git-matcher"); try { if (new ProcessBuilder() .directory(temp.toFile()) .command("git", "init", ".") .start() .waitFor() != 0) { throw new SkipException("Can't find git"); } Files.write(temp.resolve(".gitattributes"), (pattern + " test\n").getBytes(StandardCharsets.UTF_8)); byte[] output = ByteStreams.toByteArray( new ProcessBuilder() .directory(temp.toFile()) .command("git", "check-attr", "-a", "--", path) .start() .getInputStream() ); Assert.assertEquals(output.length > 0, expectedMatch == Boolean.TRUE); } finally { Files.walkFileTree(temp, new DeleteTreeVisitor()); } }
@Test public void testSignPutUrlWithTime() throws Exception { String name = "hello"; String text = "fooooooooooooooooooooooo"; Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build(); String container = getContainerName(); try { HttpRequest request = view.getSigner().signPutBlob(container, blob, 3 /* seconds */); assertEquals(request.getFilters().size(), 0); Strings2.toString(view.utils().http().invoke(request).getPayload()); assertConsistencyAwareContainerSize(container, 1); view.getBlobStore().removeBlob(container, name); assertConsistencyAwareContainerSize(container, 0); TimeUnit.SECONDS.sleep(4); try { Strings2.toString(view.utils().http().invoke(request).getPayload()); fail("Temporary URL did not expire as expected"); } catch (AuthorizationException expected) { } } catch (UnsupportedOperationException ignore) { throw new SkipException("signPutUrl with a time limit is not supported on " + provider); } finally { returnContainer(container); } }
@Test public void optionalErrorPublisherValueWorks() { DynamicValuePublisher<T> publisher = createErrorPublisher(); if (publisher == null) { throw new SkipException("Optional test: createErrorPublisher() returned null"); } T value; try { value = publisher.value(); } catch (Throwable ex) { // an exception is expected here return; } Assert.fail("The DynamicValuePublisher " + publisher + " returned an item instead of throwing: " + VerificationHelper.valueAndClass(value)); } }
public void notVerified() { throw new SkipException("Not verified using this TCK."); } }
@Test(description = "OpenSearchDescription: Query element") public void executeExampleQueries() { List<Node> exampleQueryList = ServiceMetadataUtils Namespaces.OSD11, "example")); if (exampleQueryList.isEmpty()) { throw new SkipException( "No example queries found in OpenSearch description."); continue; // skip query if it produces non-XML results Assert.assertEquals(response.getStatus(), ClientResponse.Status.OK.getStatusCode(), ErrorMessage.get(ErrorMessageKeys.UNEXPECTED_STATUS)); Assert.assertTrue(records.getLength() > 0, ErrorMessage.format(ErrorMessageKeys.EMPTY_RESULT_SET, Records.getRecordName(qryTemplate