org.junit.rules.ExternalResource Java Examples
The following examples show how to use
org.junit.rules.ExternalResource.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JerseySpecifics.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public TestRule createTestRule() { final TemporaryFolder tempFolder = new TemporaryFolder(); return RuleChain .outerRule(tempFolder) .around(new ExternalResource() { TomcatServerBootstrap bootstrap = new JerseyTomcatServerBootstrap(webXmlResource); protected void before() throws Throwable { bootstrap.setWorkingDir(tempFolder.getRoot().getAbsolutePath()); bootstrap.start(); } protected void after() { bootstrap.stop(); } }); }
Example #2
Source File: WinkSpecifics.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public TestRule createTestRule() { final TemporaryFolder tempFolder = new TemporaryFolder(); return RuleChain .outerRule(tempFolder) .around(new ExternalResource() { WinkTomcatServerBootstrap bootstrap = new WinkTomcatServerBootstrap(webXmlResource); protected void before() throws Throwable { bootstrap.setWorkingDir(tempFolder.getRoot().getAbsolutePath()); bootstrap.start(); } protected void after() { bootstrap.stop(); } }); }
Example #3
Source File: JerseySpecifics.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public TestRule createTestRule() { final TemporaryFolder tempFolder = new TemporaryFolder(); return RuleChain .outerRule(tempFolder) .around(new ExternalResource() { TomcatServerBootstrap bootstrap = new JerseyTomcatServerBootstrap(webXmlResource); protected void before() throws Throwable { bootstrap.setWorkingDir(tempFolder.getRoot().getAbsolutePath()); bootstrap.start(); } protected void after() { bootstrap.stop(); } }); }
Example #4
Source File: CXFSpecifics.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public TestRule createTestRule() { final TemporaryFolder tempFolder = new TemporaryFolder(); return RuleChain .outerRule(tempFolder) .around(new ExternalResource() { TomcatServerBootstrap bootstrap = new CXFTomcatServerBootstrap(webXmlResource); protected void before() throws Throwable { bootstrap.setWorkingDir(tempFolder.getRoot().getAbsolutePath()); bootstrap.start(); } protected void after() { bootstrap.stop(); } }); }
Example #5
Source File: ResteasySpecifics.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public TestRule createTestRule() { final TemporaryFolder tempFolder = new TemporaryFolder(); return RuleChain .outerRule(tempFolder) .around(new ExternalResource() { ResteasyTomcatServerBootstrap bootstrap = new ResteasyTomcatServerBootstrap(webXmlResource); protected void before() throws Throwable { bootstrap.setWorkingDir(tempFolder.getRoot().getAbsolutePath()); bootstrap.start(); } protected void after() { bootstrap.stop(); } }); }
Example #6
Source File: FlinkStandaloneHiveRunner.java From flink with Apache License 2.0 | 5 votes |
@Override protected List<TestRule> classRules() { final TemporaryFolder temporaryFolder = new TemporaryFolder(); try { hmsPort = HiveTestUtils.getFreePort(); } catch (IOException e) { throw new RuntimeException(e); } HiveServerContext context = new FlinkStandaloneHiveServerContext(temporaryFolder, config, hmsPort); List<TestRule> rules = super.classRules(); ExternalResource hms = new ExternalResource() { @Override protected void before() throws Throwable { LOGGER.info("Setting up {} in {}", getName(), temporaryFolder.getRoot().getAbsolutePath()); hmsWatcher = startHMS(context, hmsPort); } @Override protected void after() { if (hmsWatcher != null) { hmsWatcher.cancel(true); } } }; ExternalResource hiveShell = new ExternalResource() { @Override protected void before() throws Throwable { container = createHiveServerContainer(getTestClass().getJavaClass(), context); } @Override protected void after() { tearDown(); } }; rules.add(hiveShell); rules.add(hms); rules.add(temporaryFolder); return rules; }
Example #7
Source File: TestCatalogModel.java From netbeans with Apache License 2.0 | 5 votes |
/** * A JUnit {@link TestRule} that stops tests from interfering with one * another. JUnit will automatically set up/clean up the catalog when this * rule is used. <br/> * Usage:<br/> * {@code @Rule public final TestRule catalogMaintainer = TestCatalogModel.maintainer()} * @return the TestRule */ public static TestRule maintainer() { return new ExternalResource() { @Override protected void after() { getDefault().clearDocumentPool(); } }; }
Example #8
Source File: FlinkStandaloneHiveRunner.java From flink with Apache License 2.0 | 5 votes |
@Override protected List<TestRule> classRules() { final TemporaryFolder temporaryFolder = new TemporaryFolder(); try { hmsPort = HiveTestUtils.getFreePort(); } catch (IOException e) { throw new RuntimeException(e); } HiveServerContext context = new FlinkStandaloneHiveServerContext(temporaryFolder, config, hmsPort); List<TestRule> rules = super.classRules(); ExternalResource hms = new ExternalResource() { @Override protected void before() throws Throwable { LOGGER.info("Setting up {} in {}", getName(), temporaryFolder.getRoot().getAbsolutePath()); hmsWatcher = startHMS(context, hmsPort); } @Override protected void after() { if (hmsWatcher != null) { hmsWatcher.cancel(true); } } }; ExternalResource hiveShell = new ExternalResource() { @Override protected void before() throws Throwable { container = createHiveServerContainer(getTestClass().getJavaClass(), context); } @Override protected void after() { tearDown(); } }; rules.add(hiveShell); rules.add(hms); rules.add(temporaryFolder); return rules; }
Example #9
Source File: JerseySpecifics.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public TestRule createTestRule() { return new ExternalResource() { JerseyServerBootstrap bootstrap = new JerseyServerBootstrap(jaxRsApplication); protected void before() throws Throwable { bootstrap.start(); } protected void after() { bootstrap.stop(); } }; }
Example #10
Source File: ResteasySpecifics.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public TestRule createTestRule() { return new ExternalResource() { ResteasyServerBootstrap bootstrap = new ResteasyServerBootstrap(jaxRsApplication); protected void before() throws Throwable { bootstrap.start(); } protected void after() { bootstrap.stop(); } }; }
Example #11
Source File: JerseySpecifics.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public TestRule createTestRule() { return new ExternalResource() { JerseyServerBootstrap bootstrap = new JerseyServerBootstrap(jaxRsApplication); protected void before() throws Throwable { bootstrap.start(); } protected void after() { bootstrap.stop(); } }; }
Example #12
Source File: JerseySpecifics.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public TestRule createTestRule() { return new ExternalResource() { JerseyServerBootstrap bootstrap = new JerseyServerBootstrap(jaxRsApplication); protected void before() throws Throwable { bootstrap.start(); } protected void after() { bootstrap.stop(); } }; }
Example #13
Source File: CXFSpecifics.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public TestRule createTestRule() { return new ExternalResource() { CXFServerBootstrap bootstrap = new CXFServerBootstrap(jaxRsApplication); protected void before() throws Throwable { bootstrap.start(); } protected void after() { bootstrap.stop(); } }; }
Example #14
Source File: ResteasySpecifics.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public TestRule createTestRule() { return new ExternalResource() { ResteasyServerBootstrap bootstrap = new ResteasyServerBootstrap(jaxRsApplication); protected void before() throws Throwable { bootstrap.start(); } protected void after() { bootstrap.stop(); } }; }
Example #15
Source File: ArtifactoryServerConnection.java From artifactory-resource with Apache License 2.0 | 4 votes |
@Override public TestRule createRule() { return new ExternalResource() { }; }
Example #16
Source File: JUnitCustomRunnerTestUnitFinderTest.java From pitest with Apache License 2.0 | 4 votes |
@ClassRule public static TestRule rule() { return new ExternalResource() { }; }