Java Code Examples for org.junit.Assume#assumeFalse()

The following examples show how to use org.junit.Assume#assumeFalse() . 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: TestEncryptInterceptor.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Test
public void testGCM() throws Exception {
    try {
        src.setEncryptionAlgorithm("AES/GCM/PKCS5Padding");
        src.start(Channel.SND_TX_SEQ);
        dest.setEncryptionAlgorithm("AES/GCM/PKCS5Padding");
        dest.start(Channel.SND_TX_SEQ);
    } catch (ChannelException ce) {
        Assume.assumeFalse("Skipping testGCM due to lack of JVM support",
                ce.getCause() instanceof NoSuchAlgorithmException
                && ce.getCause().getMessage().contains("GCM"));

        throw ce;
    }

    String testInput = "The quick brown fox jumps over the lazy dog.";

    Assert.assertEquals("Failed in GCM mode",
                 testInput,
                 roundTrip(testInput, src, dest));
}
 
Example 2
Source File: JavaScriptEnginesTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Test
public void classOfSum() throws Exception {
    Assume.assumeFalse(allowAllAccess);
    Assume.assumeFalse("GraalJSScriptEngine".equals(engine.getClass().getSimpleName()));

    Object fn = engine.eval("(function(obj) {\n"
            + "  try {\n"
            + "     return obj.getClass().getName();\n"
            + "  } catch (e) {\n"
            + "     return null;\n"
            + "  }\n"
            + "})\n");
    Sum sum = new Sum();
    Object clazz = inv().invokeMethod(fn, "call", null, sum);
    assertNull("No getClass attribute of string", clazz);
}
 
Example 3
Source File: PreChunkedResponseTransferCodingTestCase.java    From quarkus-http with Apache License 2.0 6 votes vote down vote up
@Test
@Ignore("UT3 - P4")
public void sendHttpRequest() throws IOException {
    Assume.assumeFalse(DefaultServer.isH2()); //this test will still run under h2-upgrade, but will fail
    HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path");
    TestHttpClient client = new TestHttpClient();
    try {

        generateMessage(0);
        HttpResponse result = client.execute(get);
        Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
        Assert.assertEquals(message, HttpClientUtils.readResponse(result));

        generateMessage(1);
        result = client.execute(get);
        Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
        Assert.assertEquals(message, HttpClientUtils.readResponse(result));

        generateMessage(1000);
        result = client.execute(get);
        Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
        Assert.assertEquals(message, HttpClientUtils.readResponse(result));
    } finally {
        client.getConnectionManager().shutdown();
    }
}
 
Example 4
Source File: JavaClassGenerator.java    From JQF with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Method generateMethod(String className, SourceOfRandomness r) {
    int flags = r.nextInt(0, Short.MAX_VALUE);
    Type returnType = r.nextBoolean() ? Type.VOID : generateType(r, true);
    String methodName = generateMemberName(r);
    int numArgs = r.nextInt(4);
    Type[] argTypes = new Type[numArgs];
    String[] argNames = new String[numArgs];
    for (int i = 0; i < numArgs; i++) {
        argTypes[i] = generateType(r, true);
        argNames[i] = generateMemberName(r);
    }
    InstructionList code = generateCode(r, argTypes, returnType);
    MethodGen methodGen = new MethodGen(flags, returnType, argTypes, argNames, methodName, className, code, constants);
    // Validate flags
    Assume.assumeFalse(methodGen.isFinal() && methodGen.isAbstract());
    return methodGen.getMethod();
}
 
Example 5
Source File: AWSTestSuite.java    From aws-v4-signer-java with Apache License 2.0 6 votes vote down vote up
public AWSTestSuite(TestData testData) {
    super();
    this.testData = testData;

    Assume.assumeFalse(
            "This test is probably buggy: it expects us to translate '/?p aram1=val ue1' to '/?p=' without any reason.",
            "post-vanilla-query-space".equals(testData.name));

    TestAWSRequestToSign request = testData.request;

    Signer.Builder builder = Signer.builder().awsCredentials(new AwsCredentials(ACCESS_KEY, SECRET_KEY))
            .region(REGION);
    for (Header header : testData.request.headers) {
        builder.header(header);
    }

    HttpRequest httpRequest = new HttpRequest(request.method, request.pathAndQuery);
    this.signer = builder.build(httpRequest, SERVICE, request.contentHash);
}
 
Example 6
Source File: CanvasRenderingContext2D2Test.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception if the test fails
 */
@Test
@Alerts("data:image/png;base64,"
        + "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAfUlEQVR42mNgYGDgYKAyeA7E84"
        + "FYgloGqgDxciD+DMT9QCxALYMNgHg7EL8H4hog5qGWwQ5AfBoaFDlAzEItg32A+DYUR1DLYJAh"
        + "CVDXngdiD2q5FpS0CqDhux+ITahlMCgFNENTxGZoCqEKAKXZyVAXUzVj8DCMglEwEgAA1S0T6X"
        + "hdMmMAAAAASUVORK5CYII=")
public void rotateMoveToLineToStroke() throws Exception {
    Assume.assumeFalse(SKIP_);

    final String html = "<html><head>\n"
        + "<script>\n"
        + "  function test() {\n"
        + "    var canvas = document.getElementById('myCanvas');\n"
        + "    if (canvas.getContext) {\n"
        + "      var context = canvas.getContext('2d');\n"
        + "      context.rotate(.5);\n"
        + "      context.moveTo(1, 1);\n"
        + "      context.lineTo(18, 1);\n"
        + "      context.stroke();\n"
        + "      alert(canvas.toDataURL());\n"
        + "    }\n"
        + "  }\n"
        + "</script>\n"
        + "</head><body onload='test()'>\n"
        + "  <canvas id='myCanvas' width='20', height='20' style='border: 1px solid red;'></canvas>"
        + "</body></html>";

    loadPageWithAlerts(html);
}
 
Example 7
Source File: ConnectedComponentsITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testPrintWithRMatGraph() throws Exception {
	// skip 'char' since it is not printed as a number
	Assume.assumeFalse(idType.equals("char") || idType.equals("nativeChar"));

	expectedOutputChecksum(parameters(7, "print"), new Checksum(106, 0x00000024edd0568dL));
}
 
Example 8
Source File: CanvasRenderingContext2D2Test.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception if the test fails
 */
@Test
@Alerts("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAYU"
        + "lEQVR42mNgGAXUBhJA/J8MLIHP0PlQTAwgSq0KEH+H0tRQR7TNpPiEoO0kuY4YF5DkOkKu"
        + "IMt1+FxClutwuYYi12FzEUWuQ3elBzVch+zK/9RwHbIr/1PLdTBgMzzKPwBs1inGPcAUbg"
        + "AAAABJRU5ErkJggg==")
public void closePath() throws Exception {
    Assume.assumeFalse(SKIP_);

    final String html = "<html><head>\n"
        + "<script>\n"
        + "  function test() {\n"
        + "    var canvas = document.getElementById('myCanvas');\n"
        + "    if (canvas.getContext) {\n"
        + "      var context = canvas.getContext('2d');\n"
        + "      context.moveTo(4,4);\n"
        + "      context.lineTo(10,16);\n"
        + "      context.lineTo(16,4);\n"
        + "      context.closePath();\n"
        + "      context.stroke();\n"
        + "      alert(canvas.toDataURL());\n"
        + "    }\n"
        + "  }\n"
        + "</script>\n"
        + "</head><body onload='test()'>\n"
        + "  <canvas id='myCanvas' width='20', height='20' style='border: 1px solid red;'></canvas>"
        + "</body></html>";

    loadPageWithAlerts(html);
}
 
Example 9
Source File: TestBootstrapResource.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
  enableDefaultUser(false);
  Assume.assumeFalse(BaseTestServer.isMultinode());
  try (Timer.TimedBlock b = Timer.time("TestBootstrapResource.@BeforeClass")) {
    dacConfig = dacConfig.writePath(folder1.newFolder().getAbsolutePath());
    startDaemon();
  }
}
 
Example 10
Source File: CanvasRenderingContext2D2Test.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception if the test fails
 */
@Test
@Alerts("data:image/png;base64,"
        + "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAaUlEQVR42mNgGPGABYhdgFiAmobeBu"
        + "L/UHo1EFdQaslkqIHYMMySElIMdMBjIDJWIcXQx0QYmEOKgdOJMHA/KQYGEOltGWIN5AHizUD8nICB"
        + "GeTEugzUxc1YLFlPrbQKs6RitCwYBVQAABQ1QYDFZuLyAAAAAElFTkSuQmCC")
public void transformFillRect() throws Exception {
    Assume.assumeFalse(SKIP_);

    final String html = "<html><head>\n"
        + "<script>\n"
        + "  function test() {\n"
        + "    var canvas = document.getElementById('myCanvas');\n"
        + "    if (canvas.getContext) {\n"
        + "      var context = canvas.getContext('2d');\n"
        + "      context.transform(1, .2, .3, 1, 0, 0);\n"
        + "      context.fillRect(3, 3, 10, 7);\n"
        + "      alert(canvas.toDataURL());\n"
        + "    }\n"
        + "  }\n"
        + "</script>\n"
        + "</head><body onload='test()'>\n"
        + "  <canvas id='myCanvas' width='20', height='20' style='border: 1px solid red;'></canvas>"
        + "</body></html>";

    loadPageWithAlerts(html);
}
 
Example 11
Source File: MpMetricTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@Test
@RunAsClient
@InSequence(9)
public void testBaseAttributeOpenMetrics() {
    Assume.assumeFalse(Boolean.getBoolean("skip.base.metric.tests"));
    Response resp = given().header("Accept", TEXT_PLAIN).get("/metrics/base/thread.max.count");
    ResponseBuilder responseBuilder = new ResponseBuilder();
    responseBuilder.clone(resp);
    responseBuilder.setBody(filterOutAppLabelOpenMetrics(resp.getBody().asString()));
    resp = responseBuilder.build();
    resp.then().statusCode(200).and()
    .contentType(TEXT_PLAIN).and().body(containsString("# TYPE base_thread_max_count"),
            containsString("base_thread_max_count{tier=\"integration\"}"));
}
 
Example 12
Source File: ShaderTest.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testShaders() throws Exception
{
	String verifier = System.getProperty("glslang.path");
	Assume.assumeFalse("glslang.path is not set", Strings.isNullOrEmpty(verifier));

	Template[] templates = {
		new Template()
			.addInclude(GpuPlugin.class)
			.add(key ->
		{
			if ("version_header".equals(key))
			{
				return GpuPlugin.WINDOWS_VERSION_HEADER;
			}
			return null;
		}),
	};

	Shader[] shaders = {
		GpuPlugin.PROGRAM,
		GpuPlugin.COMPUTE_PROGRAM,
		GpuPlugin.SMALL_COMPUTE_PROGRAM,
		GpuPlugin.UNORDERED_COMPUTE_PROGRAM,
		GpuPlugin.UI_PROGRAM,
	};

	for (Template t : templates)
	{
		for (Shader s : shaders)
		{
			verify(t, s);
		}
	}
}
 
Example 13
Source File: CanvasRenderingContext2D2Test.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception if the test fails
 */
@Test
@Alerts("data:image/png;base64,"
        + "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAp0lEQVR42mNgGLqgnkGFoYGhHYgvA/F3IP4NZYP"
        + "EdIg3qIGBA4i7oQb8x4F/Qw3mIGQYDxCfxmMQOt4NxCz4DJxPgmEw3I0rzEwIeBMf1sDmuslkGgbC/dgMPE2Bgb"
        + "exGfidAgP/YzOQ3PDbDMQ22Ay8TIIhIN9Mxx4ZpCWZ50BcA8QixGQ1fMkG5PoUcMInCTQwrMaSE1zw5wbC+fg01"
        + "PsaDKNgQAAAd7buKpKXkaMAAAAASUVORK5CYII=")
public void arcFillPathAngle() throws Exception {
    Assume.assumeFalse(SKIP_);

    final String html = "<html><head>\n"
        + "<script>\n"
        + "  function test() {\n"
        + "    var canvas = document.getElementById('myCanvas');\n"
        + "    if (canvas.getContext) {\n"
        + "      var context = canvas.getContext('2d');\n"
        + "      context.fillStyle = 'green';\n"
        + "      context.beginPath();\n"
        + "      context.arc(10, 10, 8, 2.3, 2 * Math.PI);\n"
        + "      context.fill();\n"
        + "      alert(canvas.toDataURL());\n"
        + "    }\n"
        + "  }\n"
        + "</script>\n"
        + "</head><body onload='test()'>\n"
        + "  <canvas id='myCanvas' width='20', height='20' style='border: 1px solid red;'></canvas>"
        + "</body></html>";

    loadPageWithAlerts(html);
}
 
Example 14
Source File: TestCoreContainer.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Test
public void assertAllowPath() {
  Assume.assumeFalse(OS.isFamilyWindows());
  assertPathAllowed("/var/solr/foo");
  assertPathAllowed("/var/log/../solr/foo");
  assertPathAllowed("relative");

  assertPathBlocked("../../false");
  assertPathBlocked("./../../false");
  assertPathBlocked("/var/solr/../../etc");
}
 
Example 15
Source File: AbstractTestKVStore.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Utility method to temporarily disable test. Test must be re-enabled when ticket is resolved.
 *
 * @param ticket Jira ticket number, in the form of "DX-12345: Ticket title".
 * @param message the message explaining temporary test ignore.
 * @param classes key classes in which test should be ignored.
 */
protected void temporarilyDisableTest(String ticket, String message, Set<Class<?>> classes){
  try {
    Assume.assumeFalse("[TEST DISABLED]" + ticket + " - " + message, !Collections.disjoint(classes, storeCreationFunction.newInstance().getKeyClasses()));
  } catch (InstantiationException | IllegalAccessException e) {
    fail("TestStoreCreationFunction instantiation problem: " + e.getMessage());
  }
}
 
Example 16
Source File: PageRankITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testPrintWithRMatGraph() throws Exception {
	// skip 'char' since it is not printed as a number
	Assume.assumeFalse(idType.equals("char") || idType.equals("nativeChar"));

	expectedCount(parameters(8, "print"), 233);
}
 
Example 17
Source File: TestClose.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Test
public void testTcpClose() throws Exception {
    // TODO
    Assume.assumeFalse("This test currently fails for APR",
            getTomcatInstance().getConnector().getProtocolHandlerClassName().contains("Apr"));

    startServer(TestEndpointConfig.class);

    TesterWsClient client = new TesterWsClient("localhost", getPort());
    client.httpUpgrade(BaseEndpointConfig.PATH);
    client.closeSocket();

    awaitOnClose(CloseCodes.CLOSED_ABNORMALLY);
}
 
Example 18
Source File: DfsTest.java    From jcifs-ng with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void resolveCacheMatch () throws CIFSException, URISyntaxException {
    Assume.assumeFalse("Is standalone DFS", isStandalone());
    DfsReferralData ref = doResolve(null, "", true);
    DfsReferralData ref2 = doResolve(null, "", true);
    DfsReferralData ref3 = doResolve(null, "foo", true);
    assertNotNull(ref);
    assertNotNull(ref2);
    assertNotNull(ref3);
    assertEquals(ref, ref2);
    assertEquals(ref, ref3);
}
 
Example 19
Source File: TestServerAndClient.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Test
public void testPersistentSetServerAndClientWithLFUEvictions() throws InitializationException, IOException {
    /**
     * This bypasses the test for build environments in OS X running Java 1.8 due to a JVM bug
     * See:  https://issues.apache.org/jira/browse/NIFI-437
     */
    Assume.assumeFalse("test is skipped due to build environment being OS X with JDK 1.8. See https://issues.apache.org/jira/browse/NIFI-437",
        SystemUtils.IS_OS_MAC && SystemUtils.IS_JAVA_1_8);

    LOGGER.info("Testing " + Thread.currentThread().getStackTrace()[1].getMethodName());
    // Create server
    final File dataFile = new File("target/cache-data");
    deleteRecursively(dataFile);

    // Create server
    final TestRunner runner = TestRunners.newTestRunner(Mockito.mock(Processor.class));
    final DistributedSetCacheServer server = new SetServer();
    runner.addControllerService("server", server);
    runner.setProperty(server, DistributedSetCacheServer.PERSISTENCE_PATH, dataFile.getAbsolutePath());
    runner.setProperty(server, DistributedSetCacheServer.MAX_CACHE_ENTRIES, "3");
    runner.setProperty(server, DistributedSetCacheServer.EVICTION_POLICY, DistributedSetCacheServer.EVICTION_STRATEGY_LFU);
    runner.enableControllerService(server);

    DistributedSetCacheClientService client = createClient(server.getPort());
    final Serializer<String> serializer = new StringSerializer();
    final boolean added = client.addIfAbsent("test", serializer);
    waitABit();
    final boolean added2 = client.addIfAbsent("test2", serializer);
    waitABit();
    final boolean added3 = client.addIfAbsent("test3", serializer);
    waitABit();
    assertTrue(added);
    assertTrue(added2);
    assertTrue(added3);

    final boolean contains = client.contains("test", serializer);
    final boolean contains2 = client.contains("test2", serializer);
    assertTrue(contains);
    assertTrue(contains2);

    final boolean addedAgain = client.addIfAbsent("test", serializer);
    assertFalse(addedAgain);

    final boolean added4 = client.addIfAbsent("test4", serializer);
    assertTrue(added4);

    // ensure that added3 was evicted because it was used least frequently
    assertFalse(client.contains("test3", serializer));

    server.shutdownServer();


    final DistributedSetCacheServer newServer = new SetServer();
    runner.addControllerService("server2", newServer);
    runner.setProperty(newServer, DistributedSetCacheServer.PERSISTENCE_PATH, dataFile.getAbsolutePath());
    runner.enableControllerService(newServer);
    client.close();
    client = createClient(newServer.getPort());

    assertTrue(client.contains("test", serializer));
    assertTrue(client.contains("test2", serializer));
    assertFalse(client.contains("test3", serializer));
    assertTrue(client.contains("test4", serializer));

    newServer.shutdownServer();
    client.close();
}
 
Example 20
Source File: TestNLJE.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Test
public void noNullEquivalenceWithNullsLeft() {
  // disable since ordering is different.
  Assume.assumeFalse(true);
}