本文整理汇总了Java中org.junit.Assume.assumeTrue方法的典型用法代码示例。如果您正苦于以下问题:Java Assume.assumeTrue方法的具体用法?Java Assume.assumeTrue怎么用?Java Assume.assumeTrue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.junit.Assume
的用法示例。
在下文中一共展示了Assume.assumeTrue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: eagerlyParseMethod
import org.junit.Assume; //导入方法依赖的package包/类
@SuppressWarnings("try")
private void eagerlyParseMethod(Class<C> clazz, String methodName) {
RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
Providers providers = rt.getHostBackend().getProviders();
MetaAccessProvider metaAccess = providers.getMetaAccess();
PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
Plugins plugins = new Plugins(new InvocationPlugins());
GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true);
graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
Assume.assumeTrue(VerifyPhase.class.desiredAssertionStatus());
final Method m = getMethod(clazz, methodName);
ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
OptionValues options = getInitialOptions();
DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
try (DebugCloseable s = debug.disableIntercept(); DebugContext.Scope ds = debug.scope("GraphBuilding", graph, method)) {
graphBuilderSuite.apply(graph, context);
} catch (Throwable e) {
throw debug.handle(e);
}
}
示例2: test3
import org.junit.Assume; //导入方法依赖的package包/类
@Test
public void test3() {
Assume.assumeTrue("Only works on jdk8 right now", Java8OrEarlier);
ResolvedJavaMethod method = getResolvedJavaMethod("test3Snippet");
for (int i = 0; i < 2; i++) {
Result actual;
boolean expectedCompiledCode = (method.getProfilingInfo().getDeoptimizationCount(DeoptimizationReason.NotCompiledExceptionHandler) != 0);
InstalledCode code = getCode(method, null, false, true, new OptionValues(getInitialOptions(), HighTier.Options.Inline, false));
assertTrue(code.isValid());
try {
actual = new Result(code.executeVarargs(false), null);
} catch (Exception e) {
actual = new Result(null, e);
}
assertTrue(i > 0 == expectedCompiledCode, "expect compiled code to stay around after the first iteration");
assertEquals(new Result(expectedCompiledCode, null), actual);
assertTrue(expectedCompiledCode == code.isValid());
}
}
示例3: testReadWriteMessageSlicing
import org.junit.Assume; //导入方法依赖的package包/类
@Test
public void testReadWriteMessageSlicing() throws Exception {
// The slicing is only implemented for tell-based protocol
Assume.assumeTrue(testParameter.equals(ClientBackedDataStore.class));
leaderDatastoreContextBuilder.maximumMessageSliceSize(100);
followerDatastoreContextBuilder.maximumMessageSliceSize(100);
initDatastoresWithCars("testLargeReadReplySlicing");
final DOMStoreReadWriteTransaction rwTx = followerDistributedDataStore.newReadWriteTransaction();
final NormalizedNode<?, ?> carsNode = CarsModel.create();
rwTx.write(CarsModel.BASE_PATH, carsNode);
verifyNode(rwTx, CarsModel.BASE_PATH, carsNode);
}
示例4: testAllowsPreviouslyDeletedID
import org.junit.Assume; //导入方法依赖的package包/类
@Test
public void testAllowsPreviouslyDeletedID() {
Assume.assumeTrue("Re-use of deleted IDs not currently supported for BIGINT", versionType != JournalVersionType.BIGINT);
CalciteAssert
.model(TargetDatabase.makeJournalledModel(versionType))
.query("INSERT INTO \"" + virtualSchemaName + "\".\"emps\" (\"empid\", \"deptno\", \"last_name\") VALUES (5, 1, 'Me')")
.withHook(Hook.PROGRAM, JournalledJdbcRuleManager.program())
.updates(1);
}
示例5: testBitCountLongEmpty
import org.junit.Assume; //导入方法依赖的package包/类
@Test
public void testBitCountLongEmpty() {
Architecture arch = getBackend().getTarget().arch;
boolean isAmd64WithPopCount = arch instanceof AMD64 && ((AMD64) arch).getFeatures().contains(AMD64.CPUFeature.POPCNT);
boolean isSparc = arch instanceof SPARC;
Assume.assumeTrue("Only works on hardware with popcnt at the moment", isAmd64WithPopCount || isSparc);
ValueNode result = parseAndInline("bitCountLongEmptySnippet");
Assert.assertEquals(StampFactory.forInteger(JavaKind.Int, 0, 40), result.stamp());
}
示例6: weAreOnline
import org.junit.Assume; //导入方法依赖的package包/类
@Before
public void weAreOnline() {
try {
new TextOf(new URL("http://www.jpeek.org/")).asString();
} catch (final IOException ex) {
Assume.assumeTrue(false);
}
}
示例7: assumeFilled
import org.junit.Assume; //导入方法依赖的package包/类
public static void assumeFilled(Property... properties) {
assume(properties);
for (Property property : properties) {
Assume.assumeTrue(
String.format("Test has been skipped. \"%s\" is not allowed to be an empty String.",
property.getKey()),
!property.get().isEmpty());
}
}
示例8: narrowOopTest
import org.junit.Assume; //导入方法依赖的package包/类
@Test
public void narrowOopTest() {
Assume.assumeTrue("skipping narrow oop data patch test", runtime().getVMConfig().useCompressedOops);
test("narrowOopSnippet");
}
示例9: modifierShouldAlignInputRect
import org.junit.Assume; //导入方法依赖的package包/类
@Test
public void modifierShouldAlignInputRect() {
Assume.assumeTrue(paramsType.equals(VALID));
Rect resultRect = gravityModifier.modifyChildRect(minTop, maxBottom, testRect);
assertEquals(expectedResultRect, resultRect);
}
示例10: assumeNonMaprProfile
import org.junit.Assume; //导入方法依赖的package包/类
public static void assumeNonMaprProfile() {
Assume.assumeTrue("non mapr profile", System.getProperty("dremio.mapr.profile")==null);
}
示例11: testConnectionClose
import org.junit.Assume; //导入方法依赖的package包/类
@Test
public void testConnectionClose() throws Exception {
Assume.assumeTrue(
"This test is skipped, because this connector does not support Comet.",
isCometSupported());
// Setup Tomcat instance
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context root = tomcat.addContext("", null);
Tomcat.addServlet(root, "comet", new ConnectionCloseServlet());
root.addServletMapping("/comet", "comet");
Tomcat.addServlet(root, "hello", new HelloWorldServlet());
root.addServletMapping("/hello", "hello");
tomcat.getConnector().setProperty("connectionTimeout", "5000");
tomcat.start();
// Create connection to Comet servlet
final Socket socket =
SocketFactory.getDefault().createSocket("localhost", getPort());
socket.setSoTimeout(5000);
final OutputStream os = socket.getOutputStream();
String requestLine = "POST http://localhost:" + getPort() +
"/comet HTTP/1.1\r\n";
os.write(requestLine.getBytes());
os.write("transfer-encoding: chunked\r\n".getBytes());
os.write("\r\n".getBytes());
// Don't send any data
os.write("0\r\n\r\n".getBytes());
InputStream is = socket.getInputStream();
ResponseReaderThread readThread = new ResponseReaderThread(is);
readThread.start();
// Wait for the comet request/response to finish
int count = 0;
while (count < 10 && !readThread.getResponse().endsWith("OK")) {
Thread.sleep(500);
count++;
}
if (count == 10) {
fail("Comet request did not complete");
}
// Read thread should have terminated cleanly when the server closed the
// socket
Assert.assertFalse(readThread.isAlive());
Assert.assertNull(readThread.getException());
os.close();
is.close();
}
示例12: mayBeDisableTest
import org.junit.Assume; //导入方法依赖的package包/类
@BeforeClass
public static void mayBeDisableTest() {
Assume.assumeTrue(HekateTestProps.is("MULTICAST_ENABLED"));
}
示例13: beforeAll
import org.junit.Assume; //导入方法依赖的package包/类
public static void beforeAll() throws Exception {
Assume.assumeTrue( System.getProperty("autHost") != null);
}
示例14: testContainerLocalizer
import org.junit.Assume; //导入方法依赖的package包/类
@Test
public void testContainerLocalizer() throws Exception {
Assume.assumeTrue(shouldRun());
String locId = "container_01_01";
Path nmPrivateContainerTokensPath =
dirsHandler
.getLocalPathForWrite(ResourceLocalizationService.NM_PRIVATE_DIR
+ Path.SEPARATOR
+ String.format(ContainerLocalizer.TOKEN_FILE_NAME_FMT, locId));
files.create(nmPrivateContainerTokensPath, EnumSet.of(CREATE, OVERWRITE));
Configuration config = new YarnConfiguration(conf);
InetSocketAddress nmAddr =
config.getSocketAddr(YarnConfiguration.NM_BIND_HOST,
YarnConfiguration.NM_LOCALIZER_ADDRESS,
YarnConfiguration.DEFAULT_NM_LOCALIZER_ADDRESS,
YarnConfiguration.DEFAULT_NM_LOCALIZER_PORT);
String appId = "application_01_01";
exec = new LinuxContainerExecutor() {
@Override
public void buildMainArgs(List<String> command, String user,
String appId, String locId, InetSocketAddress nmAddr,
List<String> localDirs) {
MockContainerLocalizer.buildMainArgs(command, user, appId, locId,
nmAddr, localDirs);
}
};
exec.setConf(conf);
exec.startLocalizer(new LocalizerStartContext.Builder()
.setNmPrivateContainerTokens(nmPrivateContainerTokensPath)
.setNmAddr(nmAddr)
.setUser(appSubmitter)
.setAppId(appId)
.setLocId(locId)
.setDirsHandler(dirsHandler)
.build());
String locId2 = "container_01_02";
Path nmPrivateContainerTokensPath2 =
dirsHandler
.getLocalPathForWrite(ResourceLocalizationService.NM_PRIVATE_DIR
+ Path.SEPARATOR
+ String.format(ContainerLocalizer.TOKEN_FILE_NAME_FMT, locId2));
files.create(nmPrivateContainerTokensPath2, EnumSet.of(CREATE, OVERWRITE));
exec.startLocalizer(new LocalizerStartContext.Builder()
.setNmPrivateContainerTokens(nmPrivateContainerTokensPath2)
.setNmAddr(nmAddr)
.setUser(appSubmitter)
.setAppId(appId)
.setLocId(locId2)
.setDirsHandler(dirsHandler)
.build());
cleanupUserAppCache(appSubmitter);
}
示例15: testExternalKdcRunning
import org.junit.Assume; //导入方法依赖的package包/类
@Before
public void testExternalKdcRunning() {
Assume.assumeTrue(isExternalKdcRunning());
}