use of com.google.cloud.notebooks.v1beta1.Instance in project java-redis by googleapis.
the class ITSystemTest method testListInstances.
@Test
public void testListInstances() {
List<Instance> instances = Lists.newArrayList(client.listInstances(PARENT).iterateAll());
for (Instance instance : instances) {
if (INSTANCE_NAME.toString().equals(instance.getName())) {
assertEquals(TIER, instance.getTier());
assertEquals(INSTANCE_NAME.toString(), instance.getName());
}
}
}
use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method setUp.
@BeforeClass
public static void setUp() throws IOException, ExecutionException, InterruptedException {
// Create Test Notebook Instance
client = NotebookServiceClient.create();
ContainerImage containerImage = ContainerImage.newBuilder().setRepository(FieldBehavior.OPTIONAL.name()).build();
Environment environment = Environment.newBuilder().setName(ENVIRONMENT_NAME).setContainerImage(containerImage).build();
CreateEnvironmentRequest environmentRequest = CreateEnvironmentRequest.newBuilder().setParent(PARENT).setEnvironmentId(ENVIRONMENT_ID).setEnvironment(environment).build();
expectedEnvironmentResponse = client.createEnvironmentAsync(environmentRequest).get();
Instance notebookInstance = Instance.newBuilder().setContainerImage(containerImage).setMachineType(MACHINE_TYPE_A).build();
CreateInstanceRequest instanceRequest = CreateInstanceRequest.newBuilder().setParent(PARENT).setInstanceId(NOTEBOOK_INSTANCE_ID).setInstance(notebookInstance).build();
expectedNotebookInstance = client.createInstanceAsync(instanceRequest).get();
}
use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method testGetInstance.
@Test
public void testGetInstance() {
GetInstanceRequest request = GetInstanceRequest.newBuilder().setName(INSTANCE_NAME).build();
Instance actualNotebookInstance = client.getInstance(request);
assertEquals(expectedNotebookInstance.getContainerImage(), actualNotebookInstance.getContainerImage());
assertEquals(expectedNotebookInstance.getName(), actualNotebookInstance.getName());
assertEquals(expectedNotebookInstance.getNetwork(), actualNotebookInstance.getNetwork());
assertEquals(expectedNotebookInstance.getSubnet(), actualNotebookInstance.getSubnet());
}
use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method stopInstance.
private String stopInstance() throws ExecutionException, InterruptedException {
StopInstanceRequest request = StopInstanceRequest.newBuilder().setName(INSTANCE_NAME).build();
Instance response = client.stopInstanceAsync(request).get();
return response.getState().name();
}
use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method tearDown.
@AfterClass
public static void tearDown() throws ExecutionException, InterruptedException {
// Delete Test Environment Instance
DeleteEnvironmentRequest deleteEnvironmentRequest = DeleteEnvironmentRequest.newBuilder().setName(ENVIRONMENT_NAME).build();
client.deleteEnvironmentAsync(deleteEnvironmentRequest).get();
// Delete Test Notebook Instance
DeleteInstanceRequest deleteInstanceRequest = DeleteInstanceRequest.newBuilder().setName(INSTANCE_NAME).build();
client.deleteInstanceAsync(deleteInstanceRequest).get();
client.close();
}
Aggregations