Java 类io.dropwizard.util.Duration 实例源码

项目:dropwizard-auth-example    文件:IntegrationTest.java   
protected Client getNewSecureClient(String keyStoreResourcePath) throws Exception {
    TlsConfiguration tlsConfiguration = new TlsConfiguration();
    tlsConfiguration.setKeyStorePath(new File(resourceFilePath(keyStoreResourcePath)));
    tlsConfiguration.setKeyStorePassword("notsecret");

    tlsConfiguration.setTrustStorePath(new File(resourceFilePath("tls/test-truststore.jks")));
    tlsConfiguration.setTrustStorePassword("notsecret");

    tlsConfiguration.setVerifyHostname(false);

    tlsConfiguration.setSupportedCiphers(Lists.newArrayList("TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"));
    tlsConfiguration.setSupportedProtocols(Lists.newArrayList("TLSv1.2"));

    JerseyClientConfiguration configuration = new JerseyClientConfiguration();
    configuration.setTlsConfiguration(tlsConfiguration);
    configuration.setTimeout(Duration.seconds(30));
    configuration.setConnectionTimeout(Duration.seconds(30));
    configuration.setConnectionRequestTimeout(Duration.seconds(30));

    return new JerseyClientBuilder(USER_INFO_APP_RULE.getEnvironment())
            .using(configuration)
            .build(UUID.randomUUID().toString());
}
项目:verify-hub    文件:PolicyConfigurationBuilder.java   
private TestPolicyConfiguration(
        JerseyClientConfiguration httpClient,
        ServiceInfoConfiguration serviceInfo,
        ClientTrustStoreConfiguration clientTrustStoreConfiguration,

        Duration timeoutPeriod,
        Duration matchingServiceResponseWaitPeriod,
        Duration assertionLifetime) {

    this.eventSinkUri = URI.create("http://event-sink");
    this.samlEngineUri = URI.create("http://saml-engine");
    this.samlSoapProxyUri = URI.create("http://saml-soap-proxy");
    this.httpClient = httpClient;
    this.serviceInfo = serviceInfo;
    this.clientTrustStoreConfiguration = clientTrustStoreConfiguration;

    this.timeoutPeriod = timeoutPeriod;
    this.matchingServiceResponseWaitPeriod = matchingServiceResponseWaitPeriod;
    this.assertionLifetime = assertionLifetime;
    this.configUri = URI.create("http://config");
}
项目:dropwizard-influxdb-reporter    文件:InfluxDbTcpWriterTest.java   
@Test
public void testSerialization() throws IOException {
  final String json =
    "{" +
      "\"type\": \"tcp\"," +
      "\"host\": \"i am a host\"," +
      "\"port\": \"12345\"," +
      "\"timeout\": \"5 minutes\"" +
    "}";

  final ObjectMapper mapper = Jackson.newObjectMapper();
  mapper.registerModule(new ParameterNamesModule(JsonCreator.Mode.PROPERTIES));

  final Environment env = mock(Environment.class);
  when(env.getObjectMapper()).thenReturn(mapper);

  final InfluxDbTcpWriter.Factory factory = mapper.readValue(json, InfluxDbTcpWriter.Factory.class);
  assertEquals("expected TCP host", "i am a host", factory.host());
  assertEquals("expected TCP port", 12345, factory.port());
  assertEquals("expected TCP timeout", Duration.minutes(5), factory.timeout());
}
项目:verify-matching-service-adapter    文件:MatchingServiceAdapterConfiguration.java   
public static JerseyClientConfiguration getDefaultJerseyClientConfiguration(boolean verifyHostname, boolean trustSelfSignedCertificates) {
    JerseyClientConfiguration jerseyClientConfiguration = new JerseyClientConfiguration();
    jerseyClientConfiguration.setTimeout(Duration.seconds(60));
    jerseyClientConfiguration.setTimeToLive(Duration.minutes(10));
    jerseyClientConfiguration.setCookiesEnabled(false);
    jerseyClientConfiguration.setConnectionTimeout(Duration.seconds(4));
    jerseyClientConfiguration.setRetries(3);
    jerseyClientConfiguration.setKeepAlive(Duration.seconds(60));
    jerseyClientConfiguration.setChunkedEncodingEnabled(false);
    jerseyClientConfiguration.setValidateAfterInactivityPeriod(Duration.seconds(5));
    TlsConfiguration tlsConfiguration = new TlsConfiguration();
    tlsConfiguration.setProtocol("TLSv1.2");
    tlsConfiguration.setVerifyHostname(verifyHostname);
    tlsConfiguration.setTrustSelfSignedCertificates(trustSelfSignedCertificates);
    jerseyClientConfiguration.setTlsConfiguration(tlsConfiguration);
    jerseyClientConfiguration.setGzipEnabledForRequests(false);
    return jerseyClientConfiguration;
}
项目:dropwizard-jdbi3    文件:JdbiFactory.java   
public Jdbi build(Environment environment,
                  PooledDataSourceFactory configuration,
                  String name) {
    ManagedDataSource dataSource = configuration.build(environment.metrics(), name);
    String validationQuery = configuration.getValidationQuery();
    Jdbi jdbi = Jdbi.create(dataSource);
    jdbi.setTimingCollector(new InstrumentedTimingCollector(environment.metrics(), nameStrategy));
    jdbi.installPlugins();

    environment.lifecycle().manage(dataSource);
    environment.healthChecks().register(name, new JdbiHealthCheck(
            environment.getHealthCheckExecutorService(),
            configuration.getValidationQueryTimeout().orElseGet(() -> Duration.seconds(5)),
            jdbi, validationQuery));

    return jdbi;
}
项目:emodb    文件:AstyanaxEventReaderDAO.java   
private static ExecutorService defaultCleanupExecutor(String metricsGroup, LifeCycleRegistry lifeCycle, MetricRegistry metricRegistry) {
    final Meter meter = metricRegistry.meter(MetricRegistry.name(metricsGroup, "AstyanaxEventReaderDAO", "discarded_slab_cleanup"));
    String nameFormat = "Events Slab Reader Cleanup-" + metricsGroup.substring(metricsGroup.lastIndexOf('.') + 1) + "-%d";
    ExecutorService executor = new ThreadPoolExecutor(
            NUM_CLEANUP_THREADS, NUM_CLEANUP_THREADS,
            0L, TimeUnit.MILLISECONDS,
            new LinkedBlockingQueue<Runnable>(MAX_CLEANUP_QUEUE_LENGTH),
            new ThreadFactoryBuilder().setNameFormat(nameFormat).build(),
            new ThreadPoolExecutor.DiscardPolicy() {
                @Override
                public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
                    meter.mark();
                }
            });
    lifeCycle.manage(new ExecutorServiceManager(executor, Duration.seconds(5), nameFormat));
    return executor;
}
项目:emodb    文件:DedupMigrationTask.java   
@Override
public void execute(ImmutableMultimap<String, String> parameters, PrintWriter out) throws Exception {
    boolean oldEnabled = _dedupEnabled.get();
    boolean newEnabled = oldEnabled;

    for (String value : parameters.get("dedup")) {
        newEnabled = Boolean.parseBoolean(value);
        _dedupEnabled.set(newEnabled);
    }

    out.printf("dedup-enabled: %s%n", newEnabled);

    Collection<String> migrations = parameters.get("migrate");
    if (!migrations.isEmpty()) {
        if (newEnabled) {
            out.println("Ignoring migrations since Databus dedup is still enabled.");
        } else {
            if (oldEnabled) {
                out.println("Sleeping 15 seconds to allow in-flight requests to complete.");
                out.flush();
                Thread.sleep(Duration.seconds(15).toMilliseconds());
            }
            migrate(migrations, out);
        }
    }
}
项目:emodb    文件:DefaultRateLimitedLogFactory.java   
@VisibleForTesting
DefaultRateLimitedLogFactory(ScheduledExecutorService executor, Duration interval) {
    _executor = checkNotNull(executor, "executor");
    _interval = checkNotNull(interval, "interval");

    // After the last access we (1) hold the error up to 30 seconds before reporting it, then (2) wait to see if
    // any more instances of the error occur, after the (3) third 30-second interval of no more access we can be
    // confident that we can safely stop tracking the error and expire it from the cache.  Hence "interval * 3".
    _cache = CacheBuilder.newBuilder()
            .expireAfterAccess(interval.getQuantity() * 3, interval.getUnit())
            .build(CacheLoader.from(Functions.<Message>identity()));
    _executor.scheduleWithFixedDelay(new Runnable() {
        @Override
        public void run() {
            _cache.cleanUp();
        }
    }, 1, 1, TimeUnit.MINUTES);
}
项目:emodb    文件:DefaultRateLimitedLogFactoryTest.java   
@Test
public void testSingleError() {
    Logger log = mock(Logger.class);
    ScheduledExecutorService executor = mock(ScheduledExecutorService.class);
    RateLimitedLog rateLimitedLog =
            new DefaultRateLimitedLogFactory(executor, Duration.days(1))
                    .from(log);
    verify(executor).scheduleWithFixedDelay(Matchers.<Runnable>any(), eq(1L), eq(1L), eq(TimeUnit.MINUTES));
    Throwable t = new Throwable();

    rateLimitedLog.error(t, "Test error: {}", "first!");

    verify(log).error("Test error: first!", t);
    verify(executor).schedule(Matchers.<Runnable>any(), eq(1L), eq(TimeUnit.DAYS));
    verifyNoMoreInteractions(log, executor);
}
项目:cassandra-reaper    文件:CassandraStorage.java   
private static void overridePoolingOptions(CassandraFactory cassandraFactory) {
  PoolingOptionsFactory newPoolingOptionsFactory = new PoolingOptionsFactory() {
    @Override
    public PoolingOptions build() {
      if (null == getPoolTimeout()) {
        setPoolTimeout(Duration.minutes(2));
      }
      return super.build().setMaxQueueSize(40960);
    }
  };
  cassandraFactory.getPoolingOptions().ifPresent((originalPoolingOptions) -> {
    newPoolingOptionsFactory.setHeartbeatInterval(originalPoolingOptions.getHeartbeatInterval());
    newPoolingOptionsFactory.setIdleTimeout(originalPoolingOptions.getIdleTimeout());
    newPoolingOptionsFactory.setLocal(originalPoolingOptions.getLocal());
    newPoolingOptionsFactory.setRemote(originalPoolingOptions.getRemote());
    newPoolingOptionsFactory.setPoolTimeout(originalPoolingOptions.getPoolTimeout());
  });
  cassandraFactory.setPoolingOptions(java.util.Optional.of(newPoolingOptionsFactory));
}
项目:hawkular-apm    文件:App.java   
@Override
public void run(AppConfiguration configuration, Environment environment) throws Exception {
    configuration.getZipkinClient().setTimeout(Duration.seconds(50));
    configuration.getZipkinClient().setConnectionRequestTimeout(Duration.seconds(50));

    Brave brave = configuration.getZipkinFactory().build(environment).get();

    final Client client = new ZipkinClientBuilder(environment, brave)
            .build(configuration.getZipkinClient());

    new MySQLStatementInterceptorManagementBean(brave.clientTracer());

    /**
     * Database
     */
    createDatabase();
    DatabaseUtils.executeDatabaseScript("init.sql");

    UserDAO userDAO = new UserDAO();

    // Register resources
    environment.jersey().register(new HelloHandler());
    environment.jersey().register(new SyncHandler(client));
    environment.jersey().register(new AsyncHandler(client, brave));
    environment.jersey().register(new UsersHandler(userDAO, client, brave));
}
项目:dropwizard-http2-client    文件:JettyClientConfigurationTest.java   
@Test
public void testHttp2() {
    final JettyClientConfiguration conf = load("http2-client.yml");
    assertThat(conf.getIdleTimeout()).isEqualTo(Duration.minutes(5));
    assertThat(conf.getConnectionTimeout()).isEqualTo(Duration.seconds(1));

    assertThat(conf.getConnectionFactoryBuilder())
            .isInstanceOf(Http2ClientTransportFactory.class);
    final Http2ClientTransportFactory http2 = (Http2ClientTransportFactory)
            conf.getConnectionFactoryBuilder();

    assertThat(http2.getKeyStorePath()).isEqualTo("client.jks");
    assertThat(http2.getKeyStorePassword()).isEqualTo("http2_client");
    assertThat(http2.getKeyStoreType()).isEqualTo("JKS");

    assertThat(http2.getTrustStorePath()).isEqualTo("servers.jks");
    assertThat(http2.getTrustStorePassword()).isEqualTo("http2_server");
    assertThat(http2.getTrustStoreType()).isEqualTo("JKS");

    assertThat(http2.getSupportedProtocols()).containsOnly("TLSv1.2");
    assertThat(http2.getSupportedCipherSuites()).containsOnly("TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256");
}
项目:dropwizard-http2-client    文件:JettyClientConfigurationTest.java   
@Test
public void testHttps() {
    final JettyClientConfiguration conf = load("https-client.yml");
    assertThat(conf.getIdleTimeout()).isEqualTo(Duration.minutes(5));
    assertThat(conf.getConnectionTimeout()).isEqualTo(Duration.seconds(1));

    assertThat(conf.getConnectionFactoryBuilder())
            .isInstanceOf(HttpsClientTransportFactory.class);
    final HttpsClientTransportFactory https = (HttpsClientTransportFactory)
            conf.getConnectionFactoryBuilder();

    assertThat(https.getKeyStorePath()).isEqualTo("client.jks");
    assertThat(https.getKeyStorePassword()).isEqualTo("http2_client");
    assertThat(https.getKeyStoreType()).isEqualTo("JKS");

    assertThat(https.getTrustStorePath()).isEqualTo("servers.jks");
    assertThat(https.getTrustStorePassword()).isEqualTo("http2_server");
    assertThat(https.getTrustStoreType()).isEqualTo("JKS");

    assertThat(https.getSupportedProtocols()).containsOnly("TLSv1.2");
    assertThat(https.getSupportedCipherSuites()).containsOnly("TLS_ECDHE.*");
}
项目:dropwizard-entitymanager    文件:EntityManagerBundle.java   
@Override
public final void run(T configuration, Environment environment) throws Exception {
    final PooledDataSourceFactory dbConfig = getDataSourceFactory(configuration);

    this.entityManagerFactory = entityManagerFactoryFactory.build(this, environment, dbConfig, entities, name());
    this.entityManagerContext = new EntityManagerContext(entityManagerFactory);
    this.sharedEntityManager = sharedEntityManagerFactory.build(entityManagerContext);

    registerUnitOfWorkListerIfAbsent(environment).registerEntityManagerFactory(name(), entityManagerFactory);
    environment.healthChecks().register(name(),
            new EntityManagerFactoryHealthCheck(
                    environment.getHealthCheckExecutorService(),
                    dbConfig.getValidationQueryTimeout().orElse(Duration.seconds(5)),
                    entityManagerFactory,
                    dbConfig.getValidationQuery()));
}
项目:resilience-tutorial    文件:AnalysisServiceFactory.java   
public AnalysisServiceClient build(Environment environment) {
    final HttpClientConfiguration httpConfig = new HttpClientConfiguration();
    httpConfig.setTimeout(Duration.milliseconds(getTimeout()));
    final HttpClient httpClient = new HttpClientBuilder(environment).using(httpConfig)
            .build("analysis-http-client");

    AnalysisServiceClient client = new AnalysisServiceClientAdapter(getHost(), getPort(),
            getPortFailover(), getPath(), httpClient);

    environment.lifecycle().manage(new Managed() {
        @Override
        public void start() {
        }

        @Override
        public void stop() {
        }
    });

    return client;
}
项目:dropwizard-caching-bundle    文件:LocalCacheConfiguration.java   
public Cache<String, CachedResponse> buildCache() {
    CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder();

    if (!_expire.isPresent() && !_maximumSize.isPresent()) {
        cacheBuilder.maximumSize(0);
    } else {
        if (_expire.isPresent()) {
            Duration expire = _expire.get();
            cacheBuilder.expireAfterWrite(expire.getQuantity(), expire.getUnit());
        }

        if (_maximumSize.isPresent()) {
            cacheBuilder
                    .weigher(CachedResponseWeigher.INSTANCE)
                    .maximumWeight(_maximumSize.get().toBytes());
        }
    }

    return cacheBuilder.build();
}
项目:airpal    文件:CachingUsageStore.java   
public CachingUsageStore(final UsageStore delegate, final Duration expireAfter)
{
    this.delegate = delegate;
    this.cache = CacheBuilder
            .newBuilder()
            .expireAfterWrite(expireAfter.getQuantity(), expireAfter.getUnit())
            .build(new CacheLoader<Table, Long>()
            {
                @Override
                public Long load(Table table)
                        throws Exception
                {
                    return delegate.getUsages(table);
                }
            });
}
项目:dropwizard-cassandra    文件:LatencyAwarePolicyFactoryTest.java   
@Test
public void buildsPolicyWithAllParams() throws Exception {
    final LatencyAwarePolicyFactory factory = new LatencyAwarePolicyFactory();
    factory.setSubPolicy(subPolicyFactory);
    factory.setExclusionThreshold(1.0d);
    factory.setMinimumMeasurements(2);
    factory.setRetryPeriod(Duration.minutes(3));
    factory.setScale(Duration.milliseconds(100));
    factory.setUpdateRate(Duration.seconds(5));

    final LoadBalancingPolicy policy = factory.build();

    assertThat(policy).isSameAs(resultingPolicy);
    verify(subPolicyFactory).build();

    InOrder inOrder = inOrder(policyBuilder);
    inOrder.verify(policyBuilder).withExclusionThreshold(1.0d);
    inOrder.verify(policyBuilder).withMininumMeasurements(2);
    inOrder.verify(policyBuilder).withRetryPeriod(3L, TimeUnit.MINUTES);
    inOrder.verify(policyBuilder).withScale(100L, TimeUnit.MILLISECONDS);
    inOrder.verify(policyBuilder).withUpdateRate(5L, TimeUnit.SECONDS);
    inOrder.verify(policyBuilder).build();
}
项目:dropwizard-cassandra    文件:PoolingOptionsFactoryTest.java   
@Test
public void buildsPoolingOptionsWithConfiguredValues() throws Exception {
    // given
    final PoolingOptionsFactory factory = new PoolingOptionsFactory();
    factory.setHeartbeatInterval(Duration.minutes(1));
    factory.setPoolTimeout(Duration.seconds(2));
    factory.setLocal(createHostDistanceOptions(1, 3, 5, 25));
    factory.setRemote(createHostDistanceOptions(2, 4, 6, 30));

    // when
    final PoolingOptions poolingOptions = factory.build();

    // then
    assertThat(poolingOptions.getHeartbeatIntervalSeconds()).isEqualTo(60);
    assertThat(poolingOptions.getPoolTimeoutMillis()).isEqualTo(2000);

    assertThat(poolingOptions.getCoreConnectionsPerHost(HostDistance.LOCAL)).isEqualTo(1);
    assertThat(poolingOptions.getMaxConnectionsPerHost(HostDistance.LOCAL)).isEqualTo(3);
    assertThat(poolingOptions.getMaxRequestsPerConnection(HostDistance.LOCAL)).isEqualTo(5);
    assertThat(poolingOptions.getNewConnectionThreshold(HostDistance.LOCAL)).isEqualTo(25);

    assertThat(poolingOptions.getCoreConnectionsPerHost(HostDistance.REMOTE)).isEqualTo(2);
    assertThat(poolingOptions.getMaxConnectionsPerHost(HostDistance.REMOTE)).isEqualTo(4);
    assertThat(poolingOptions.getMaxRequestsPerConnection(HostDistance.REMOTE)).isEqualTo(6);
    assertThat(poolingOptions.getNewConnectionThreshold(HostDistance.REMOTE)).isEqualTo(30);
}
项目:backups    文件:ScheduledHealthCheck.java   
private ScheduledHealthCheck(final HealthCheck delegate, final String name, final ScheduledExecutorService executor, final Duration frequency, final MetricRegistry metricRegistry) {
    result = new AtomicReference<>(Result.unhealthy("Scheduled health check not yet checked."));
    supplier = new Supplier<Result>() {
        @Override
        public Result get() {
            LOG.trace("Running scheduled health check: {}", name);
            return delegate.execute();
        }
    };

    processor = new AbstractScheduledProcessor(executor, frequency, INITIAL_DELAY, name, metricRegistry) {
        @Override
        public void execute() {
            result.set(supplier.get());
        }
    };
}
项目:backups    文件:DistributedLock.java   
public void acquire(Duration timeout, Duration retryDelay) {
    final long stopTime = System.nanoTime() + timeout.toNanoseconds();
    final long retryDelayMillis = retryDelay.toMilliseconds();

    try {
        while (System.nanoTime() < stopTime) {
            if (lock.tryAcquire()) {
                return;
            }

            Thread.sleep(retryDelayMillis);
        }

        throw new TimeoutException("Unable to acquire " + this);
    }
    catch (Exception e) {
        throw new LockException(e);
    }
}
项目:backups    文件:RetentionPolicyProcessorTest.java   
@Test
public void testCombinedRetentionPolicy() throws IOException {
    // We expect to delete all but 19 copies (16 for DWMY, +3 for last duration) of each service
    final int expected = storage.listAll().size() - (19 * storage.listAllRows().size());

    final CombinedRetentionPolicy<BackupMetadata> retentionPolicy = new CombinedRetentionPolicy<>(
            new LastCountRetentionPolicy<BackupMetadata>(2),
            new LastDurationRetentionPolicy<BackupMetadata>(Duration.days(10)),
            new DWMYRetentionPolicy(7, 4, 6, 0)
    );
    final RetentionPolicyProcessor processor = new RetentionPolicyProcessor(
            fileStorage,
            Location.OFFSITE,
            backupProcessor,
            null,
            retentionPolicy,
            EnumSet.of(BackupMetadata.State.FINISHED),
            LOCAL_NODE,
            new MetricRegistry()
    );
    processor.execute();

    verify(backupProcessor, times(expected)).deleteFromFileStorage(eq(fileStorage), any(Location.class), any(BackupMetadata.class));
}
项目:backups    文件:OverdueMetadataHealthCheckTest.java   
@Test
public void testNotCompletedNotBackupsIgnored() throws Exception {
    storage.put(createBackup("feedie", BackupMetadata.State.WAITING));
    storage.put(createBackup("feedie", BackupMetadata.State.RECEIVING));
    storage.put(createBackup("feedie", BackupMetadata.State.QUEUED));
    storage.put(createBackup("feedie", BackupMetadata.State.UPLOADING));
    storage.put(createBackup("feedie", BackupMetadata.State.FINISHED));

    assertTrue(healthcheck.check().isHealthy());

    // Shift time by a week
    setDateOffset(Duration.days(7));

    assertFalse(healthcheck.check().isHealthy());

    storage.put(createBackup("feedie", BackupMetadata.State.FINISHED));
    assertTrue(healthcheck.check().isHealthy());
}
项目:backups    文件:OverdueMetadataHealthCheckTest.java   
@Test
public void testServicesAreCheckedIndividually() throws Exception {
    storage.put(createBackup("feedie", BackupMetadata.State.FINISHED));
    storage.put(createBackup("hermes", BackupMetadata.State.FINISHED));

    assertTrue(healthcheck.check().isHealthy());

    // Shift time by a week
    setDateOffset(Duration.days(7));

    storage.put(createBackup("hermes", BackupMetadata.State.FINISHED));
    assertFalse(healthcheck.check().isHealthy());

    storage.put(createBackup("feedie", BackupMetadata.State.FINISHED));
    assertTrue(healthcheck.check().isHealthy());
}
项目:CredentialStorageService    文件:CredentialStorageApplicationTest.java   
@Before
public void createClient() {
    final JerseyClientConfiguration configuration = new JerseyClientConfiguration();
    configuration.setTimeout(Duration.minutes(1L));
    configuration.setConnectionTimeout(Duration.minutes(1L));
    configuration.setConnectionRequestTimeout(Duration.minutes(1L));
    this.client = new JerseyClientBuilder(this.RULE.getEnvironment()).using(configuration)
            .build("test client");

    assertThat(this.client
            .target(String.format(CREDENTIAL_END_POINT, this.RULE.getLocalPort()))
            .request()
            .header(X_AUTH_RSA_HEADER, BASE_64_PUBLIC_KEY)
            .post(Entity.json(this.credential)).getStatus())
                    .isEqualTo(Status.CREATED.getStatusCode());
}
项目:dropwizard-tinkerpop    文件:TinkerPopHealthCheck.java   
public TinkerPopHealthCheck(
        Cluster cluster,
        String validationGremlinQuery,
        Duration validationTimeout) {

    this.client = cluster.connect();
    this.validationGremlinQuery = validationGremlinQuery;
    this.validationTimeout = validationTimeout;
}
项目:verify-hub    文件:HubMetadataIntegrationTests.java   
@BeforeClass
public static void setUp() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = new JerseyClientConfiguration();
    jerseyClientConfiguration.setConnectionTimeout(Duration.seconds(10));
    jerseyClientConfiguration.setTimeout(Duration.seconds(10));
    client = new JerseyClientBuilder(samlProxyAppRule.getEnvironment())
            .using(jerseyClientConfiguration)
            .build(HubMetadataIntegrationTests.class.getName());
    DateTimeFreezer.freezeTime();
}
项目:verify-hub    文件:SamlMessageReceiverApiResourceTest.java   
@BeforeClass
public static void setUpClient() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client =  new JerseyClientBuilder(samlProxyAppRule.getEnvironment()).using(jerseyClientConfiguration).build
            (SamlMessageReceiverApiResourceTest.class.getSimpleName());
    eventSinkStubRule.register(Urls.HubSupportUrls.HUB_SUPPORT_EVENT_SINK_RESOURCE, Response.Status.OK.getStatusCode());
}
项目:verify-hub    文件:SamlMessageReceiverApiResourceEidasEnabledTest.java   
@BeforeClass
public static void setUpClient() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client =  new JerseyClientBuilder(samlProxyAppRule.getEnvironment()).using(jerseyClientConfiguration).build
            (SamlMessageReceiverApiResourceEidasEnabledTest.class.getSimpleName());
    eventSinkStubRule.register(Urls.HubSupportUrls.HUB_SUPPORT_EVENT_SINK_RESOURCE, Response.Status.OK.getStatusCode());
}
项目:verify-hub    文件:SamlMessageReceiverApiResourceEidasDisabledTest.java   
@BeforeClass
public static void setUpClient() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client =  new JerseyClientBuilder(samlProxyAppRule.getEnvironment()).using(jerseyClientConfiguration).build
            (SamlMessageReceiverApiResourceEidasDisabledTest.class.getSimpleName());
    eventSinkStubRule.register(Urls.HubSupportUrls.HUB_SUPPORT_EVENT_SINK_RESOURCE, Response.Status.OK.getStatusCode());
}
项目:verify-hub    文件:HubAsIdpMetadataHandlerTest.java   
@Before
public void setUp() throws Exception {
    when(samlProxyConfiguration.getFrontendExternalUri()).thenReturn(URI.create("http://localhost"));
    when(samlProxyConfiguration.getMetadataValidDuration()).thenReturn(Duration.parse("5h"));
    when(samlProxyConfiguration.getMetadataConfiguration()).thenReturn(metadataConfiguration);

    handler = new HubAsIdpMetadataHandler(
            metadataResolver,
            samlProxyConfiguration,
            TestEntityIds.HUB_ENTITY_ID,
            hubFederationId);
}
项目:verify-hub    文件:EidasSessionResourceContractTest.java   
@BeforeClass
public static void beforeClass() throws Exception {
    IdaSamlBootstrap.bootstrap();
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(policy.getEnvironment())
        .using(jerseyClientConfiguration)
        .build(EidasSessionResourceContractTest.class.getSimpleName());
    sessionId = SessionId.createNewSessionId();
    samlAuthnResponseContainerDto = createAuthnResponseSignedByKeyPair(sessionId, TestCertificateStrings.STUB_IDP_PUBLIC_PRIMARY_CERT, TestCertificateStrings.STUB_IDP_PUBLIC_PRIMARY_PRIVATE_KEY);
    encryptedIdentityAssertion = AssertionBuilder.anAssertion().withId(UUID.randomUUID().toString()).build();
    encryptedIdentityAssertionString = XML_OBJECT_XML_OBJECT_TO_BASE_64_ENCODED_STRING_TRANSFORMER.apply(encryptedIdentityAssertion);
}
项目:verify-hub    文件:EidasSessionResourceIntegrationTest.java   
@BeforeClass
public static void beforeClass() {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(policy.getEnvironment())
            .using(jerseyClientConfiguration)
            .build(EidasSessionResourceIntegrationTest.class.getSimpleName());
}
项目:verify-hub    文件:EidasDisabledIntegrationTest.java   
@BeforeClass
public static void beforeClass() {
    JerseyClientConfiguration
        jerseyClientConfiguration =
        JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client =
        new JerseyClientBuilder(policy.getEnvironment()).using(jerseyClientConfiguration).build(EidasDisabledIntegrationTest.class.getSimpleName());
}
项目:verify-hub    文件:EidasMatchingServiceResourceIntegrationTest.java   
@BeforeClass
public static void beforeClass() {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(policy.getEnvironment())
        .using(jerseyClientConfiguration)
        .build(EidasMatchingServiceResourceIntegrationTest.class.getSimpleName());
}
项目:verify-hub    文件:PolicyConfigurationBuilder.java   
public PolicyConfiguration build() {
    return new TestPolicyConfiguration(
            new JerseyClientConfiguration(),
            serviceInfo,
            mock(ClientTrustStoreConfiguration.class),
            timeoutPeriod,
            Duration.minutes(1),
            Duration.minutes(15));
}
项目:verify-hub    文件:MatchingServiceHealthcheckResponseTranslatorResourceTest.java   
@BeforeClass
public static void setup() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder
            .aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(samlEngineAppRule.getEnvironment()).using(jerseyClientConfiguration)
            .build(MatchingServiceHealthcheckResponseTranslatorResourceTest.class.getSimpleName());
}
项目:verify-hub    文件:CountryMatchingServiceRequestGeneratorResourceTest.java   
@BeforeClass
public static void setupClass() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder
        .aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(samlEngineAppRule.getEnvironment()).using(jerseyClientConfiguration)
        .build(CountryMatchingServiceRequestGeneratorResourceTest.class.getSimpleName());
}
项目:verify-hub    文件:HealthCheckWithoutCountryTest.java   
@BeforeClass
public static void setupClass() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder
        .aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(samlEngineAppRule.getEnvironment()).using(jerseyClientConfiguration)
        .build(HealthCheckWithoutCountryTest.class.getSimpleName());
}
项目:verify-hub    文件:MatchingServiceRequestGeneratorResourceTest.java   
@BeforeClass
public static void setup() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder
            .aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(samlEngineAppRule.getEnvironment()).using(jerseyClientConfiguration)
            .build(MatchingServiceRequestGeneratorResourceTest.class.getSimpleName());
}