use of io.pravega.test.system.framework.services.Service in project pravega by pravega.
the class PravegaTest method createStream.
/**
* Invoke the createStream method, ensure we are able to create stream.
*
* @throws InterruptedException if interrupted
* @throws URISyntaxException If URI is invalid
* @throws ExecutionException if error in create stream
*/
@Before
public void createStream() throws InterruptedException, ExecutionException {
Service conService = Utils.createPravegaControllerService(null);
List<URI> ctlURIs = conService.getServiceDetails();
URI controllerUri = ctlURIs.get(0);
log.info("Invoking create stream with Controller URI: {}", controllerUri);
@Cleanup ConnectionFactory connectionFactory = new ConnectionFactoryImpl(ClientConfig.builder().build());
ControllerImpl controller = new ControllerImpl(ControllerImplConfig.builder().clientConfig(ClientConfig.builder().controllerURI(controllerUri).build()).build(), connectionFactory.getInternalExecutor());
assertTrue(controller.createScope(STREAM_SCOPE).get());
assertTrue(controller.createStream(config).get());
}
use of io.pravega.test.system.framework.services.Service in project pravega by pravega.
the class StreamCutsTest method setup.
@Before
public void setup() {
Service conService = Utils.createPravegaControllerService(null);
List<URI> ctlURIs = conService.getServiceDetails();
controllerURI = ctlURIs.get(0);
final ClientConfig clientConfig = Utils.buildClientConfig(controllerURI);
controller = new ControllerImpl(ControllerImplConfig.builder().clientConfig(clientConfig).maxBackoffMillis(5000).build(), executor);
streamManager = StreamManager.create(clientConfig);
assertTrue("Creating scope", streamManager.createScope(SCOPE));
assertTrue("Creating stream one", streamManager.createStream(SCOPE, STREAM_ONE, StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(RG_PARALLELISM_ONE)).build()));
assertTrue("Creating stream two", streamManager.createStream(SCOPE, STREAM_TWO, StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(RG_PARALLELISM_TWO)).build()));
}
use of io.pravega.test.system.framework.services.Service in project pravega by pravega.
the class ZookeeperTest method zkTest.
/**
* Invoke the zookeeper test, ensure zookeeper can be accessed.
* The test fails in case zookeeper cannot be accessed.
*/
@Test
public void zkTest() {
log.info("Start execution of ZkTest");
Service zk = Utils.createZookeeperService();
URI zkUri = zk.getServiceDetails().get(0);
CuratorFramework curatorFrameworkClient = CuratorFrameworkFactory.newClient(zkUri.getHost() + ":2181", new RetryOneTime(5000));
curatorFrameworkClient.start();
log.info("CuratorFramework status {} ", curatorFrameworkClient.getState());
assertEquals("Connection to zk client ", STARTED, curatorFrameworkClient.getState());
log.info("Zookeeper Service URI : {} ", zkUri);
log.info("ZkTest execution completed");
}
use of io.pravega.test.system.framework.services.Service in project pravega by pravega.
the class AbstractScaleTests method createControllerURI.
private URI createControllerURI() {
Service conService = Utils.createPravegaControllerService(null);
List<URI> ctlURIs = conService.getServiceDetails();
return ctlURIs.get(0);
}
use of io.pravega.test.system.framework.services.Service in project pravega by pravega.
the class DynamicRestApiTest method listScopes.
@Test
public void listScopes() {
Service controllerService = Utils.createPravegaControllerService(null);
List<URI> controllerURIs = controllerService.getServiceDetails();
URI controllerGRPCUri = controllerURIs.get(0);
URI controllerRESTUri = controllerURIs.get(1);
Invocation.Builder builder;
String protocol = Utils.TLS_AND_AUTH_ENABLED ? "https://" : "http://";
restServerURI = protocol + controllerRESTUri.getHost() + ":" + controllerRESTUri.getPort();
log.info("REST Server URI: {}", restServerURI);
// Validate the liveliness of the server through a 'ping' request.
resourceURl = new StringBuilder(restServerURI).append("/ping").toString();
webTarget = client.target(resourceURl);
builder = webTarget.request();
@Cleanup Response response = builder.get();
assertEquals(String.format("Received unexpected status code: %s in response to 'ping' request.", response.getStatus()), OK.getStatusCode(), response.getStatus());
final String scope1 = RandomStringUtils.randomAlphanumeric(10);
final String stream1 = RandomStringUtils.randomAlphanumeric(10);
String responseAsString = null;
ClientConfig clientConfig = Utils.buildClientConfig(controllerGRPCUri);
// Create a scope.
@Cleanup StreamManager streamManager = StreamManager.create(clientConfig);
assertNotNull(streamManager);
boolean isScopeCreated = streamManager.createScope(scope1);
assertTrue("Failed to create scope", isScopeCreated);
// Create a stream.
boolean isStreamCreated = streamManager.createStream(scope1, stream1, StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(1)).build());
assertTrue("Failed to create stream", isStreamCreated);
// Validate that the scope is returned from the request.
webTarget = client.target(restServerURI).path("v1").path("scopes");
builder = webTarget.request();
response = builder.get();
assertEquals("Get scopes failed.", OK.getStatusCode(), response.getStatus());
responseAsString = response.readEntity(String.class);
assertTrue(responseAsString.contains(String.format("\"scopeName\":\"%s\"", scope1)));
// Validate that the stream is returned from the request.
webTarget = client.target(restServerURI).path("v1").path("scopes").path(scope1).path("streams");
builder = webTarget.request();
response = builder.get();
assertEquals("Get streams failed.", OK.getStatusCode(), response.getStatus());
responseAsString = response.readEntity(String.class);
assertTrue(responseAsString.contains(String.format("\"streamName\":\"%s\"", stream1)));
}
Aggregations