/** * Returns a {@code RuleChain} with a single {@link TestRule}. This method * is the usual starting point of a {@code RuleChain}. * * @param outerRule the outer rule of the {@code RuleChain}. * @return a {@code RuleChain} with a single {@link TestRule}. */ public static RuleChain outerRule(TestRule outerRule) { return emptyRuleChain().around(outerRule); }
/** * Returns a {@code RuleChain} with a single {@link TestRule}. This method * is the usual starting point of a {@code RuleChain}. * * @param outerRule the outer rule of the {@code RuleChain}. * @return a {@code RuleChain} with a single {@link TestRule}. */ public static RuleChain outerRule(TestRule outerRule) { return emptyRuleChain().around(outerRule); }
protected AbstractJdbcAppenderFactoryMethodTest(final JdbcRule jdbcRule, final String databaseType) { this.rules = RuleChain.emptyRuleChain().around(jdbcRule).around(new LoggerContextRule( "org/apache/logging/log4j/core/appender/db/jdbc/log4j2-" + databaseType + "-factory-method.xml")); this.jdbcRule = jdbcRule; }
protected JdbcAppenderMapMessageDataSourceTest(final JdbcRule jdbcRule) { // @formatter:off this.rules = RuleChain.emptyRuleChain() .around(new JndiRule("java:/comp/env/jdbc/TestDataSourceAppender", createMockDataSource())) .around(jdbcRule) .around(new LoggerContextRule("org/apache/logging/log4j/core/appender/db/jdbc/log4j2-data-source-map-message.xml")); // @formatter:on this.jdbcRule = jdbcRule; }
protected AbstractJdbcAppenderDataSourceTest(final JdbcRule jdbcRule) { this.rules = RuleChain.emptyRuleChain() .around(new JndiRule("java:/comp/env/jdbc/TestDataSourceAppender", createMockDataSource())) .around(jdbcRule) .around(new LoggerContextRule( "org/apache/logging/log4j/core/appender/db/jdbc/log4j2-data-source.xml")); this.jdbcRule = jdbcRule; }
public RuleChain withCleanFilesRule(final String... files) { return RuleChain.outerRule(new CleanFiles(files)).around(this); }
public RuleChain withCleanFoldersRule(final String... folders) { return RuleChain.outerRule(new CleanFolders(folders)).around(this); }
public RandomAccessFileAppenderTest(final String testName, final boolean locationEnabled, final String type) { this.init = new LoggerContextRule(testName + type); this.logFile = new File("target", testName + ".log"); this.files = new CleanFiles(this.logFile); this.locationEnabled = locationEnabled; this.chain = RuleChain.outerRule(files).around(init); }
public RuleChain withCleanFoldersRule(final boolean before, final boolean after, final int maxTries, final String... folders) { return RuleChain.outerRule(new CleanFolders(before, after, maxTries, folders)).around(this); }
@Override public Statement apply( Statement base, Description description ) { if ( chain == null ) { if ( fs == null ) { fs = new EphemeralFileSystemRule(); } this.pageCacheRule = new PageCacheRule( pageCacheConfig ); this.directory = TestDirectory.testDirectory( clazz, fs ); this.chain = RuleChain.outerRule( fs ).around( directory ).around( pageCacheRule ); } return chain.apply( base, description ); }
/** * Creates a {@link RuleChain} where the rules are evaluated in the order you pass in. * * @param testRules * test rules to evaluate * @return a new rule chain. */ public static RuleChain create(final TestRule... testRules) { if (testRules == null || testRules.length == 0) { return RuleChain.emptyRuleChain(); } RuleChain ruleChain = RuleChain.outerRule(testRules[0]); for (int i = 1; i < testRules.length; i++) { ruleChain = ruleChain.around(testRules[i]); } return ruleChain; } }
@Rule public final TestRule repeatWithDifferentRandomization() { return RuleChain.outerRule( new RepeatRule() ).around( random ); }
public ConfigurationTest(final String configFileName, final String logFileName) { this.logFileName = logFileName; this.init = new LoggerContextRule(configFileName); rules = RuleChain.outerRule(new CleanFiles(logFileName)).around(this.init); }
public XmlCompleteFileAppenderTest(final Class<ContextSelector> contextSelector) { this.loggerContextRule = new LoggerContextRule("XmlCompleteFileAppenderTest.xml", contextSelector); this.cleanFiles = new CleanFiles(logFile); this.ruleChain = RuleChain.outerRule(cleanFiles).around(loggerContextRule); }
public JsonCompleteFileAppenderTest(final Class<ContextSelector> contextSelector) { this.loggerContextRule = new LoggerContextRule("JsonCompleteFileAppenderTest.xml", contextSelector); this.cleanFiles = new CleanFiles(logFile); this.ruleChain = RuleChain.outerRule(cleanFiles).around(loggerContextRule); }
public XIncludeTest(final String configFileName, final String logFileName) { this.logFileName = logFileName; this.init = new LoggerContextRule(configFileName); this.rules = RuleChain.outerRule(new CleanFiles(logFileName)).around(this.init); }
public DataSourceConnectionSourceTest(final String jndiURL) { this.rules = RuleChain.outerRule(new JndiRule(jndiURL, dataSource)) .around(new LoggerContextRule(CONFIG)); this.jndiURL = jndiURL; }
/** * Returns a {@code RuleChain} with a single {@link TestRule}. This method * is the usual starting point of a {@code RuleChain}. * * @param outerRule the outer rule of the {@code RuleChain}. * @return a {@code RuleChain} with a single {@link TestRule}. */ public static RuleChain outerRule(TestRule outerRule) { return emptyRuleChain().around(outerRule); }
public static RuleChain setup( Class<?> eteClass, String composeFile, List<String> availableClientNames, Map<String, String> environment) { availableClients = ImmutableList.copyOf(availableClientNames); DockerMachine machine = DockerMachine.localMachine().withEnvironment(environment).build(); String logDirectory = EteSetup.class.getSimpleName() + "-" + eteClass.getSimpleName(); docker = DockerComposeRule.builder() .file(composeFile) .machine(machine) .saveLogsTo(LogDirectory.circleAwareLogDirectory(logDirectory)) .shutdownStrategy(ShutdownStrategy.AGGRESSIVE_WITH_NETWORK_CLEANUP) .build(); DockerProxyRule dockerProxyRule = DockerProxyRule.fromProjectName(docker.projectName(), eteClass); return RuleChain .outerRule(GRADLE_PREPARE_TASK) .around(docker) .around(dockerProxyRule) .around(waitForServersToBeReady()); }
public StreamProcessorRule(int partitionId, ZeebeDbFactory dbFactory) { rule = new SetupRule(partitionId); zeebeDbFactory = dbFactory; chain = RuleChain.outerRule(tempFolder) .around(actorSchedulerRule) .around(serviceContainerRule) .around(closeables) .around(new FailedTestRecordPrinter()) .around(rule); }