org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable Java Examples

The following examples show how to use org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable. 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: SftpTest.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Test
@DisabledIfEnvironmentVariable(named = "JENKINS_ASF_CI", matches = "true")
public void testSftpComponent() throws InterruptedException {
    // Create a new file on the SFTP server
    RestAssured.given()
            .contentType(ContentType.TEXT)
            .body("Hello Camel Quarkus SFTP")
            .post("/sftp/create/hello.txt")
            .then()
            .statusCode(201);

    // Read file back from the SFTP server
    RestAssured.get("/sftp/get/hello.txt")
            .then()
            .statusCode(200)
            .body(is("Hello Camel Quarkus SFTP"));
}
 
Example #2
Source File: CuriostackRootPluginTest.java    From curiostack with MIT License 6 votes vote down vote up
@Test
// This test is slow since it runs yarn, just run locally for now.
@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
void updatesResolutions() {
  assertThat(
          GradleRunner.create()
              .withProjectDir(projectDir.toFile())
              .withArguments(":checkNodeResolutions")
              .withPluginClasspath())
      .fails()
      .tasksDidRun(":checkNodeResolutions");

  assertThat(
          GradleRunner.create()
              .withProjectDir(projectDir.toFile())
              .withArguments(":updateNodeResolutions")
              .withPluginClasspath())
      .builds()
      .tasksDidSucceed(":updateNodeResolutions");
}
 
Example #3
Source File: ReadmeTest.java    From graphviz-java with Apache License 2.0 6 votes vote down vote up
@Test
@DisabledIfEnvironmentVariable(named = "CI", matches = ".*")
void ex5() throws IOException {
    //## config
    Graphviz.useEngine(new GraphvizCmdLineEngine()); // Rasterizer.builtIn() works only with CmdLineEngine
    Graph g = graph("example5").directed().with(node("abc").link(node("xyz")));
    Graphviz viz = Graphviz.fromGraph(g);
    viz.width(200).render(Format.SVG).toFile(new File("example/ex5.svg"));
    viz.width(200).rasterize(Rasterizer.BATIK).toFile(new File("example/ex5b.png"));
    viz.width(200).rasterize(Rasterizer.SALAMANDER).toFile(new File("example/ex5s.png"));
    viz.width(200).rasterize(Rasterizer.builtIn("pdf")).toFile(new File("example/ex5p"));
    String dot = viz.render(Format.DOT).toString();
    String json = viz.engine(Engine.NEATO).render(Format.JSON).toString();
    BufferedImage image = viz.render(Format.PNG).toImage();
    //## end
    end();
    init();
}
 
Example #4
Source File: CuriostackRootPluginTest.java    From curiostack with MIT License 5 votes vote down vote up
@Test
// This test is slow since it downloads a file, just run locally for now.
@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
void terraformInstallsKubectl() {
  assertThat(
          GradleRunner.create()
              .withProjectDir(projectDir.toFile())
              .withArguments(":terraform:terraformInit", "--stacktrace")
              .withPluginClasspath())
      .builds()
      .tasksDidSucceed(":gcloudInstallComponents", ":terraform:terraformInit");
}
 
Example #5
Source File: CuriostackRootPluginTest.java    From curiostack with MIT License 5 votes vote down vote up
@Test
// This test is slow since it runs yarn, just run locally for now.
@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
void checksResolutions() {
  assertThat(
          GradleRunner.create()
              .withProjectDir(projectDir.toFile())
              .withArguments(":checkNodeResolutions")
              .withPluginClasspath())
      .builds()
      .tasksDidSucceed(":checkNodeResolutions");
}
 
Example #6
Source File: ConsumerTest.java    From strimzi-kafka-bridge with Apache License 2.0 5 votes vote down vote up
@DisabledIfEnvironmentVariable(named = "BRIDGE_EXTERNAL_ENV", matches = "((?i)FALSE(?-i))")
@Test
void createConsumerEmptyBody(VertxTestContext context) throws InterruptedException, TimeoutException, ExecutionException {
    AtomicReference<String> name = new AtomicReference<>();
    // create consumer
    CompletableFuture<Boolean> create = new CompletableFuture<>();
    consumerService().createConsumerRequest(groupId, null)
            .send(ar -> {
                context.verify(() -> {
                    assertThat(ar.succeeded(), is(true));
                    HttpResponse<JsonObject> response = ar.result();
                    assertThat(response.statusCode(), is(HttpResponseStatus.OK.code()));
                    JsonObject bridgeResponse = response.body();
                    String consumerInstanceId = bridgeResponse.getString("instance_id");
                    name.set(consumerInstanceId);
                    String consumerBaseUri = bridgeResponse.getString("base_uri");
                    assertThat(consumerInstanceId.startsWith(config.get(BridgeConfig.BRIDGE_ID).toString()), is(true));
                    assertThat(consumerBaseUri, is(Urls.consumerInstance(groupId, consumerInstanceId)));
                });
                create.complete(true);
            });

    create.get(TEST_TIMEOUT, TimeUnit.SECONDS);
    consumerService()
        .deleteConsumer(context, groupId, name.get());
    context.completeNow();
    assertThat(context.awaitCompletion(TEST_TIMEOUT, TimeUnit.SECONDS), is(true));
}
 
Example #7
Source File: DefaultLocalDriverProviderTest.java    From webdriver-factory with Apache License 2.0 5 votes vote down vote up
@Test
@EnabledOnOs(OS.WINDOWS)
@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
void canInstantiateInternetExplorerDriverWithInternetExplorerOptions() {
  driver = provider.createDriver(new InternetExplorerOptions());
  assertTrue(driver instanceof InternetExplorerDriver);
}
 
Example #8
Source File: DefaultLocalDriverProviderTest.java    From webdriver-factory with Apache License 2.0 5 votes vote down vote up
@Test
@EnabledOnOs(OS.WINDOWS)
@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
void canInstantiateEdgeDriverWithEdgeOptions() {
  driver = provider.createDriver(new EdgeOptions());
  assertTrue(driver instanceof EdgeDriver);
}
 
Example #9
Source File: DefaultLocalDriverProviderTest.java    From webdriver-factory with Apache License 2.0 5 votes vote down vote up
@Test
@EnabledOnOs(OS.MAC)
@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
void canInstantiateSafariDriverWithSafariOptions() {
  driver = provider.createDriver(new SafariOptions());
  assertTrue(driver instanceof SafariDriver);
}
 
Example #10
Source File: RendererTest.java    From graphviz-java with Apache License 2.0 5 votes vote down vote up
@Test
@DisabledIfEnvironmentVariable(named = "CI", matches = ".*")
void builtInRasterizer() throws IOException {
    final File out = new File("target/builtIn.pdf");
    out.delete();
    Graphviz.useEngine(new GraphvizCmdLineEngine());
    final Graphviz g = Graphviz.fromGraph(graph().with(node("a").link("b")));
    g.basedir(new File("example")).rasterize(Rasterizer.builtIn("pdf")).toFile(new File("target/builtIn"));
    assertTrue(out.exists());
    end();
    init();
}
 
Example #11
Source File: ReadmeTest.java    From graphviz-java with Apache License 2.0 5 votes vote down vote up
@Test
@DisabledIfEnvironmentVariable(named = "CI", matches = ".*")
void ex7() throws IOException {
    //## img
    Graphviz.useEngine(new GraphvizCmdLineEngine());
    Graphviz g = Graphviz.fromGraph(graph()
            .with(node(Label.html("<table border='0'><tr><td><img src='graphviz.png' /></td></tr></table>"))));
    g.basedir(new File("example")).render(Format.PNG).toFile(new File("example/ex7.png"));
    //## img
}
 
Example #12
Source File: DisabledTests.java    From journaldev with MIT License 4 votes vote down vote up
@Test
@DisabledIfEnvironmentVariable(named = "USER", matches = "pankaj")
void test6() {
	assertFalse(3 < 0);
}
 
Example #13
Source File: ProducerTest.java    From strimzi-kafka-bridge with Apache License 2.0 4 votes vote down vote up
@Disabled("Will be check in the next PR, this is just external tests for Bridge")
@DisabledIfEnvironmentVariable(named = "BRIDGE_EXTERNAL_ENV", matches = "((?i)FALSE(?-i))")
@Test
void sendBinaryMessageWithKey(VertxTestContext context) {
    String topic = "sendBinaryMessageWithKey";
    kafkaCluster.createTopic(topic, 2, 1);

    String value = "message-value";
    String key = "my-key-bin";

    JsonArray records = new JsonArray();
    JsonObject json = new JsonObject();
    json.put("value", DatatypeConverter.printBase64Binary(value.getBytes()));
    json.put("key", DatatypeConverter.printBase64Binary(key.getBytes()));
    records.add(json);

    JsonObject root = new JsonObject();
    root.put("records", records);

    producerService()
        .sendRecordsRequest(topic, root, BridgeContentType.KAFKA_JSON_BINARY)
            .sendJsonObject(root, verifyOK(context));

    Properties config = kafkaCluster.getConsumerProperties();

    KafkaConsumer<byte[], byte[]> consumer = KafkaConsumer.create(vertx, config,
            new ByteArrayDeserializer(), new ByteArrayDeserializer());
    consumer.handler(record -> {
        context.verify(() -> {
            assertThat(new String(record.value()), is(value));
            assertThat(record.topic(), is(topic));
            assertThat(record.partition(), notNullValue());
            assertThat(record.offset(), is(0L));
            assertThat(new String(record.key()), is(key));
        });

        LOGGER.info("Message consumed topic={} partition={} offset={}, key={}, value={}",
                record.topic(), record.partition(), record.offset(), record.key(), record.value());
        consumer.close();
        context.completeNow();
    });

    consumer.subscribe(topic, done -> {
        if (!done.succeeded()) {
            context.failNow(done.cause());
        }
    });
}
 
Example #14
Source File: DefaultLocalDriverProviderTest.java    From webdriver-factory with Apache License 2.0 4 votes vote down vote up
@Test
@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
void canInstantiateFirefoxDriverWithFirefoxOptions() {
  driver = provider.createDriver(new FirefoxOptions());
  assertTrue(driver instanceof FirefoxDriver);
}
 
Example #15
Source File: DefaultLocalDriverProviderTest.java    From webdriver-factory with Apache License 2.0 4 votes vote down vote up
@Test
@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
void canInstantiateChromeDriverWithChromeOptions() {
  driver = provider.createDriver(new ChromeOptions());
  assertTrue(driver instanceof ChromeDriver);
}