类org.junit.rules.ExternalResource源码实例Demo

下面列出了怎么用org.junit.rules.ExternalResource的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: camunda-bpm-platform   文件: JerseySpecifics.java
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();
      }
    });
}
 
源代码2 项目: camunda-bpm-platform   文件: WinkSpecifics.java
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();
      }
    });
}
 
源代码3 项目: camunda-bpm-platform   文件: JerseySpecifics.java
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();
      }
    });
}
 
源代码4 项目: camunda-bpm-platform   文件: CXFSpecifics.java
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();
      }
    });
}
 
源代码5 项目: camunda-bpm-platform   文件: ResteasySpecifics.java
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();
      }
    });
}
 
源代码6 项目: flink   文件: FlinkStandaloneHiveRunner.java
@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;
}
 
源代码7 项目: netbeans   文件: TestCatalogModel.java
/**
 * 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();
        }
    
    };
}
 
源代码8 项目: flink   文件: FlinkStandaloneHiveRunner.java
@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;
}
 
源代码9 项目: camunda-bpm-platform   文件: JerseySpecifics.java
public TestRule createTestRule() {
  return new ExternalResource() {

    JerseyServerBootstrap bootstrap = new JerseyServerBootstrap(jaxRsApplication);

    protected void before() throws Throwable {
      bootstrap.start();
    }

    protected void after() {
      bootstrap.stop();
    }
  };
}
 
源代码10 项目: camunda-bpm-platform   文件: ResteasySpecifics.java
public TestRule createTestRule() {
  return new ExternalResource() {

    ResteasyServerBootstrap bootstrap = new ResteasyServerBootstrap(jaxRsApplication);

    protected void before() throws Throwable {
      bootstrap.start();
    }

    protected void after() {
      bootstrap.stop();
    }
  };
}
 
源代码11 项目: camunda-bpm-platform   文件: JerseySpecifics.java
public TestRule createTestRule() {
  return new ExternalResource() {

    JerseyServerBootstrap bootstrap = new JerseyServerBootstrap(jaxRsApplication);

    protected void before() throws Throwable {
      bootstrap.start();
    }

    protected void after() {
      bootstrap.stop();
    }
  };
}
 
源代码12 项目: camunda-bpm-platform   文件: JerseySpecifics.java
public TestRule createTestRule() {
  return new ExternalResource() {

    JerseyServerBootstrap bootstrap = new JerseyServerBootstrap(jaxRsApplication);

    protected void before() throws Throwable {
      bootstrap.start();
    }

    protected void after() {
      bootstrap.stop();
    }
  };
}
 
源代码13 项目: camunda-bpm-platform   文件: CXFSpecifics.java
public TestRule createTestRule() {
  return new ExternalResource() {

    CXFServerBootstrap bootstrap = new CXFServerBootstrap(jaxRsApplication);

    protected void before() throws Throwable {
      bootstrap.start();
    }

    protected void after() {
      bootstrap.stop();
    }
  };
}
 
源代码14 项目: camunda-bpm-platform   文件: ResteasySpecifics.java
public TestRule createTestRule() {
  return new ExternalResource() {

    ResteasyServerBootstrap bootstrap = new ResteasyServerBootstrap(jaxRsApplication);

    protected void before() throws Throwable {
      bootstrap.start();
    }

    protected void after() {
      bootstrap.stop();
    }
  };
}
 
@Override
public TestRule createRule() {
	return new ExternalResource() {

	};
}
 
@ClassRule
public static TestRule rule() {
  return new ExternalResource() {
  };
}