@Override public Statement apply(Statement base, Description description) { try { SplunkServer splunkServer = new SplunkServer(); splunkServer.setPassword("admin"); splunkServer.setUsername("admin"); SplunkServiceFactory splunkServiceFactory = new SplunkServiceFactory(splunkServer); splunkServiceFactory.getService().open(this.port); System.setProperty("splunk.port", "" + this.port); } catch (Exception e) { logger.warn( "Not executing tests because basic connectivity test failed"); Assume.assumeNoException(e); } return super.apply(base, description); }
@Override public Statement apply(Statement base, Description description) { if (!this.shouldRun) { LOGGER.info("Skipping long running test " + description.getDisplayName()); return new Statement() { @Override public void evaluate() { Assume.assumeTrue(false); } }; } else { return super.apply(base, description); } }
@Override public Statement apply(Statement base, Description description) { if (this.skip) { LogFactory.getLog(this.getClass()).info("No Multicast support; test skipped"); return new Statement() { @Override public void evaluate() throws Throwable { Assume.assumeTrue(false); } }; } else { return super.apply(base, description); } }
@Override public Statement apply(Statement base, Description description) { if (description.getAnnotation(TailAvailable.class) != null) { if (!tailWorksOnThisMachine()) { return new Statement() { @Override public void evaluate() throws Throwable { // skip } }; } } return super.apply(base, description); }
@Override public Statement apply(Statement base, Description description) { return super.apply(base, description); }
@Override public Statement apply(Statement base, Description description) { return super.apply(base, description); }
@Override public Statement apply(Statement base, Description description) { assumeTrue(brokerOnline.get(port)); String url = "tcp://localhost:" + port; IMqttClient client = null; try { client = new DefaultMqttPahoClientFactory().getClientInstance(url, "junit-" + System.currentTimeMillis()); client.connect(); } catch (MqttException e) { logger.warn("Tests not running because no broker on " + url + ":", e); assumeNoException(e); } finally { if (client != null) { try { client.disconnect(); client.close(); } catch (MqttException e) { } } } return super.apply(base, description); }
@Override public Statement apply(Statement base, Description description) { if (!description.isSuite()) { System.err.println("WARNING: Rule " + getClass().getSimpleName() + " is intended for use as a static @ClassRule. Using it as a regular Rule may have unintended effects, or unnecessarily slow down your tests."); } return super.apply(base, description); } }
@Override public Statement apply(Statement base, Description description) { return scratchDirRule.apply(super.apply(base, description), description); }
@Override public Statement apply(Statement base, Description description) { if (!this.shouldRun) { logger.info("Skipping long running test " + description.toString()); } Assume.assumeTrue(this.shouldRun); return super.apply(base, description); }
@Override public Statement apply(Statement base, Description description) { if (!this.shouldRun) { logger.info("Skipping long running test " + description.toString()); } Assume.assumeTrue(this.shouldRun); return super.apply(base, description); }
return super.apply(base, description);
return super.apply(base, description);
@Override public Statement apply(final Statement base, Description description) { logger.info("Environment: " + key + " active=" + isActive()); Assume.assumeTrue(isActive()); return super.apply(base, description); }
@Override public Statement apply(Statement base, Description description) { assumeTrue(dynamoDbOnline.get(this.port)); String url = "http://localhost:" + this.port; this.amazonDynamoDB = AmazonDynamoDBAsyncClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("", ""))) .withClientConfiguration( new ClientConfiguration() .withMaxErrorRetry(0) .withConnectionTimeout(1000)) .withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration(url, Regions.DEFAULT_REGION.getName())) .build(); try { this.amazonDynamoDB.listTables(); } catch (SdkClientException e) { logger.warn("Tests not running because no DynamoDb on " + url, e); assumeNoException(e); } return super.apply(base, description); }