Search in sources :

Example 21 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project dropwizard by dropwizard.

the class DropwizardSSLConnectionSocketFactoryTest method shouldReturn200IfAbleToClientAuth.

@Test
// https://github.com/dropwizard/dropwizard/issues/4330
@DisabledOnOs(OS.WINDOWS)
void shouldReturn200IfAbleToClientAuth() throws Exception {
    tlsConfiguration.setKeyStorePath(toFile("stores/client/keycert.p12"));
    tlsConfiguration.setKeyStorePassword("password");
    tlsConfiguration.setKeyStoreType("PKCS12");
    final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("client_auth_working");
    final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(2))).request().get();
    assertThat(response.getStatus()).isEqualTo(200);
}
Also used : ClientResponse(org.glassfish.jersey.client.ClientResponse) Response(javax.ws.rs.core.Response) Client(javax.ws.rs.client.Client) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 22 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project dropwizard by dropwizard.

the class DropwizardSSLConnectionSocketFactoryTest method shouldSucceedWithBcProvider.

@Test
// https://github.com/dropwizard/dropwizard/issues/4330
@DisabledOnOs(OS.WINDOWS)
void shouldSucceedWithBcProvider() throws Exception {
    // switching host verifier off for simplicity
    tlsConfiguration.setVerifyHostname(false);
    tlsConfiguration.setKeyStorePath(toFile("stores/client/acme-weak.keystore.p12"));
    tlsConfiguration.setKeyStorePassword("acme2");
    tlsConfiguration.setKeyStoreType("PKCS12");
    tlsConfiguration.setKeyStoreProvider(PROVIDER_NAME);
    tlsConfiguration.setCertAlias("acme-weak");
    tlsConfiguration.setTrustStorePath(toFile("stores/server/acme-weak.truststore.p12"));
    tlsConfiguration.setTrustStorePassword("acme2");
    tlsConfiguration.setTrustStoreType("PKCS12");
    tlsConfiguration.setTrustStoreProvider(PROVIDER_NAME);
    final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("custom_jce_supported");
    final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(5))).request().get();
    assertThat(response.getStatus()).isEqualTo(200);
}
Also used : ClientResponse(org.glassfish.jersey.client.ClientResponse) Response(javax.ws.rs.core.Response) Client(javax.ws.rs.client.Client) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 23 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project dropwizard by dropwizard.

the class HealthCheckManagerTest method shouldContinueScheduledCheckingWhileDelayingShutdown.

@Test
@DisabledOnOs(OS.WINDOWS)
void shouldContinueScheduledCheckingWhileDelayingShutdown() throws Exception {
    // given
    final int checkIntervalMillis = 10;
    final int shutdownWaitTimeMillis = 50;
    final int expectedCount = shutdownWaitTimeMillis / checkIntervalMillis - 1;
    final AtomicBoolean shutdownFailure = new AtomicBoolean(false);
    final CountingHealthCheck check = new CountingHealthCheck();
    final Schedule schedule = new Schedule();
    schedule.setCheckInterval(Duration.milliseconds(checkIntervalMillis));
    final HealthCheckConfiguration checkConfig = new HealthCheckConfiguration();
    checkConfig.setName("check1");
    checkConfig.setCritical(true);
    checkConfig.setSchedule(schedule);
    final List<HealthCheckConfiguration> configs = singletonList(checkConfig);
    final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1);
    final HealthCheckScheduler scheduler = new HealthCheckScheduler(executorService);
    final MetricRegistry metrics = new MetricRegistry();
    final Duration shutdownWaitPeriod = Duration.milliseconds(shutdownWaitTimeMillis);
    // when
    final HealthCheckManager manager = new HealthCheckManager(configs, scheduler, metrics, shutdownWaitPeriod, true, Collections.emptyList());
    manager.onHealthCheckAdded("check1", check);
    // simulate JVM shutdown hook
    final Thread shutdownThread = new Thread(() -> {
        try {
            manager.notifyShutdownStarted();
        } catch (Exception e) {
            shutdownFailure.set(true);
            e.printStackTrace();
        }
    });
    Thread.sleep(20);
    long beforeCount = check.getCount();
    shutdownThread.start();
    shutdownThread.join();
    Thread.sleep(20);
    long afterCount = check.getCount();
    // then
    assertThat(shutdownFailure).isFalse();
    assertThat(afterCount - beforeCount).isGreaterThanOrEqualTo(expectedCount);
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) MetricRegistry(com.codahale.metrics.MetricRegistry) Duration(io.dropwizard.util.Duration) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 24 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project jgnash by ccavanaugh.

the class AutoCompleteModelTest method testPayeeMemoModels.

@Test
@DisabledOnOs(OS.MAC)
void testPayeeMemoModels() {
    Options.useFuzzyMatchForAutoCompleteProperty().set(true);
    final Engine engine = createEngine("payee-test");
    final Account account = new Account(AccountType.CASH, engine.getDefaultCurrency());
    engine.addAccount(engine.getRootAccount(), account);
    assertEquals(1, engine.getAccountList().size());
    final LocalDate localDate = LocalDate.of(2000, Month.JANUARY, 1);
    // create a bunch of transactions
    for (int i = 1; i <= TRANSACTION_COUNT; i++) {
        final Transaction t = TransactionFactory.generateSingleEntryTransaction(account, BigDecimal.TEN, localDate.plusDays(i), "Memo " + i, "Payee " + i, Integer.toString(i));
        engine.addTransaction(t);
        assertEquals(i, engine.getTransactions().size());
    }
    assertEquals(TRANSACTION_COUNT, engine.getTransactions().size());
    final AutoCompleteTextField<Transaction> autoCompletePayeeTextField = new AutoCompleteTextField<>();
    AutoCompleteFactory.setPayeeModel(autoCompletePayeeTextField, account);
    final AutoCompleteTextField<Transaction> autoCompleteMemoTextField = new AutoCompleteTextField<>();
    AutoCompleteFactory.setMemoModel(autoCompleteMemoTextField);
    final AutoCompleteModel<Transaction> payeeModel = autoCompletePayeeTextField.autoCompleteModelObjectProperty().get();
    final AutoCompleteModel<Transaction> memoModel = autoCompleteMemoTextField.autoCompleteModelObjectProperty().get();
    final AtomicBoolean payeeModelLoaded = payeeModel.isLoadComplete();
    final AtomicBoolean memoModelLoaded = memoModel.isLoadComplete();
    // Block until the atomics have been set, or the test will fail
    Awaitility.await().untilTrue(payeeModelLoaded);
    Awaitility.await().untilTrue(memoModelLoaded);
    // noinspection SpellCheckingInspection
    final String payeeResult = payeeModel.doLookAhead("Paye");
    final String memoResult = memoModel.doLookAhead("Me");
    assertEquals("Payee " + TRANSACTION_COUNT, payeeResult);
    assertEquals("Memo " + TRANSACTION_COUNT, memoResult);
    EngineFactory.closeEngine(EngineFactory.DEFAULT);
}
Also used : Account(jgnash.engine.Account) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AutoCompleteTextField(jgnash.uifx.control.AutoCompleteTextField) Transaction(jgnash.engine.Transaction) LocalDate(java.time.LocalDate) Engine(jgnash.engine.Engine) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 25 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project spring-boot by spring-projects.

the class BootBuildImageIntegrationTests method buildsImageWithBuildpackFromTarGzip.

@TestTemplate
@DisabledOnOs(OS.WINDOWS)
void buildsImageWithBuildpackFromTarGzip() throws IOException {
    writeMainClass();
    writeLongNameResource();
    writeBuildpackContent();
    tarGzipBuildpackContent();
    BuildResult result = this.gradleBuild.build("bootBuildImage", "--pullPolicy=IF_NOT_PRESENT");
    String projectName = this.gradleBuild.getProjectDir().getName();
    assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
    assertThat(result.getOutput()).contains("docker.io/library/" + projectName);
    assertThat(result.getOutput()).contains("---> Hello World buildpack");
    removeImages(projectName);
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) TestTemplate(org.junit.jupiter.api.TestTemplate)

Aggregations

DisabledOnOs (org.junit.jupiter.api.condition.DisabledOnOs)85 Test (org.junit.jupiter.api.Test)78 Path (java.nio.file.Path)38 File (java.io.File)24 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)15 PathsBaseTest (org.assertj.core.internal.PathsBaseTest)12 AssertionsUtil.expectAssertionError (org.assertj.core.util.AssertionsUtil.expectAssertionError)11 PosixFilePermission (java.nio.file.attribute.PosixFilePermission)6 PageSwapperFactory (org.neo4j.io.pagecache.PageSwapperFactory)6 PageSwapperTest (org.neo4j.io.pagecache.PageSwapperTest)6 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)5 DelegatingStoreChannel (org.neo4j.io.fs.DelegatingStoreChannel)5 StoreChannel (org.neo4j.io.fs.StoreChannel)5 DisabledForRoot (org.neo4j.test.extension.DisabledForRoot)5 Closeable (java.io.Closeable)4 URI (java.net.URI)4 FileUtils.writeByteArrayToFile (org.apache.commons.io.FileUtils.writeByteArrayToFile)4 ShouldBeFile.shouldBeFile (org.assertj.core.error.ShouldBeFile.shouldBeFile)4 FilesBaseTest (org.assertj.core.internal.FilesBaseTest)4 Files.newFile (org.assertj.core.util.Files.newFile)4