Search in sources :

Example 1 with ControllerImplConfig

use of io.pravega.client.control.impl.ControllerImplConfig in project pravega by pravega.

the class PravegaEmulatorResource method waitUntilHealthy.

/*
     * Wait until Pravega standalone is up and running.
     */
private void waitUntilHealthy() {
    ClientConfig clientConfig = getClientConfig();
    ControllerImplConfig controllerConfig = ControllerImplConfig.builder().clientConfig(clientConfig).retryAttempts(20).initialBackoffMillis(1000).backoffMultiple(2).maxBackoffMillis(10000).build();
    @Cleanup StreamManager streamManager = new StreamManagerImpl(clientConfig, controllerConfig);
    assertNotNull(streamManager);
    // Try creating a scope. This will retry based on the provided retry configuration.
    // If all the retries fail a RetriesExhaustedException will be thrown failing the tests.
    boolean isScopeCreated = streamManager.createScope("healthCheck-scope");
    log.debug("Health check scope creation is successful {}", isScopeCreated);
}
Also used : ControllerImplConfig(io.pravega.client.control.impl.ControllerImplConfig) StreamManager(io.pravega.client.admin.StreamManager) StreamManagerImpl(io.pravega.client.admin.impl.StreamManagerImpl) ClientConfig(io.pravega.client.ClientConfig) Cleanup(lombok.Cleanup)

Example 2 with ControllerImplConfig

use of io.pravega.client.control.impl.ControllerImplConfig in project pravega by pravega.

the class TlsEnabledInProcPravegaClusterTest method testCreateStreamFailsWithInvalidClientConfig.

/**
 * This test verifies that create stream fails when the client config is invalid.
 *
 * Note: The timeout being used for the test is kept rather large so that there is ample time for the expected
 * exception to be raised even in case of abnormal delays in test environments.
 */
@Test(timeout = 50000)
public void testCreateStreamFailsWithInvalidClientConfig() {
    // Truststore for the TLS connection is missing.
    ClientConfig clientConfig = ClientConfig.builder().controllerURI(URI.create(EMULATOR.pravega.getInProcPravegaCluster().getControllerURI())).build();
    ControllerImplConfig controllerImplConfig = ControllerImplConfig.builder().clientConfig(clientConfig).retryAttempts(1).initialBackoffMillis(1000).backoffMultiple(1).maxBackoffMillis(1000).build();
    @Cleanup StreamManager streamManager = new StreamManagerImpl(clientConfig, controllerImplConfig);
    AssertExtensions.assertThrows("TLS exception did not occur.", () -> streamManager.createScope(scope), e -> hasTlsException(e));
}
Also used : ControllerImplConfig(io.pravega.client.control.impl.ControllerImplConfig) StreamManager(io.pravega.client.admin.StreamManager) StreamManagerImpl(io.pravega.client.admin.impl.StreamManagerImpl) ClientConfig(io.pravega.client.ClientConfig) Cleanup(lombok.Cleanup) Test(org.junit.Test)

Aggregations

ClientConfig (io.pravega.client.ClientConfig)2 StreamManager (io.pravega.client.admin.StreamManager)2 StreamManagerImpl (io.pravega.client.admin.impl.StreamManagerImpl)2 ControllerImplConfig (io.pravega.client.control.impl.ControllerImplConfig)2 Cleanup (lombok.Cleanup)2 Test (org.junit.Test)1