Search in sources :

Example 66 with LocationName

use of com.google.cloud.speech.v1p1beta1.LocationName in project java-dlp by googleapis.

the class DlpServiceClientTest method createDeidentifyTemplateExceptionTest.

@Test
public void createDeidentifyTemplateExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockDlpService.addException(exception);
    try {
        LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
        DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
        client.createDeidentifyTemplate(parent, deidentifyTemplate);
        Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
    // Expected exception.
    }
}
Also used : InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) StatusRuntimeException(io.grpc.StatusRuntimeException) OrganizationLocationName(com.google.privacy.dlp.v2.OrganizationLocationName) LocationName(com.google.privacy.dlp.v2.LocationName) DeidentifyTemplate(com.google.privacy.dlp.v2.DeidentifyTemplate) Test(org.junit.Test)

Example 67 with LocationName

use of com.google.cloud.speech.v1p1beta1.LocationName in project java-dlp by googleapis.

the class DlpServiceClientTest method createJobTriggerExceptionTest.

@Test
public void createJobTriggerExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockDlpService.addException(exception);
    try {
        LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
        JobTrigger jobTrigger = JobTrigger.newBuilder().build();
        client.createJobTrigger(parent, jobTrigger);
        Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
    // Expected exception.
    }
}
Also used : InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) StatusRuntimeException(io.grpc.StatusRuntimeException) JobTrigger(com.google.privacy.dlp.v2.JobTrigger) OrganizationLocationName(com.google.privacy.dlp.v2.OrganizationLocationName) LocationName(com.google.privacy.dlp.v2.LocationName) Test(org.junit.Test)

Example 68 with LocationName

use of com.google.cloud.speech.v1p1beta1.LocationName in project java-dlp by googleapis.

the class DlpServiceClientTest method createDlpJobExceptionTest2.

@Test
public void createDlpJobExceptionTest2() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockDlpService.addException(exception);
    try {
        LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
        RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build();
        client.createDlpJob(parent, riskJob);
        Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
    // Expected exception.
    }
}
Also used : InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) StatusRuntimeException(io.grpc.StatusRuntimeException) RiskAnalysisJobConfig(com.google.privacy.dlp.v2.RiskAnalysisJobConfig) OrganizationLocationName(com.google.privacy.dlp.v2.OrganizationLocationName) LocationName(com.google.privacy.dlp.v2.LocationName) Test(org.junit.Test)

Example 69 with LocationName

use of com.google.cloud.speech.v1p1beta1.LocationName in project java-dlp by googleapis.

the class DlpServiceClientTest method createDlpJobExceptionTest.

@Test
public void createDlpJobExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockDlpService.addException(exception);
    try {
        LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
        InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build();
        client.createDlpJob(parent, inspectJob);
        Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
    // Expected exception.
    }
}
Also used : InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) StatusRuntimeException(io.grpc.StatusRuntimeException) OrganizationLocationName(com.google.privacy.dlp.v2.OrganizationLocationName) LocationName(com.google.privacy.dlp.v2.LocationName) InspectJobConfig(com.google.privacy.dlp.v2.InspectJobConfig) Test(org.junit.Test)

Example 70 with LocationName

use of com.google.cloud.speech.v1p1beta1.LocationName in project java-dlp by googleapis.

the class DlpServiceClientTest method listJobTriggersExceptionTest.

@Test
public void listJobTriggersExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockDlpService.addException(exception);
    try {
        LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
        client.listJobTriggers(parent);
        Assert.fail("No exception raised");
    } catch (InvalidArgumentException e) {
    // Expected exception.
    }
}
Also used : InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) StatusRuntimeException(io.grpc.StatusRuntimeException) OrganizationLocationName(com.google.privacy.dlp.v2.OrganizationLocationName) LocationName(com.google.privacy.dlp.v2.LocationName) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)34 LocationName (com.google.privacy.dlp.v2.LocationName)22 OrganizationLocationName (com.google.privacy.dlp.v2.OrganizationLocationName)22 AbstractMessage (com.google.protobuf.AbstractMessage)18 AutoMlClient (com.google.cloud.automl.v1.AutoMlClient)17 LocationName (com.google.cloud.automl.v1.LocationName)17 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)16 StatusRuntimeException (io.grpc.StatusRuntimeException)14 LocationName (com.google.cloud.translate.v3.LocationName)13 TranslationServiceClient (com.google.cloud.translate.v3.TranslationServiceClient)13 OperationMetadata (com.google.cloud.automl.v1.OperationMetadata)12 AutoMlClient (com.google.cloud.automl.v1beta1.AutoMlClient)12 LocationName (com.google.cloud.automl.v1beta1.LocationName)12 LocationName (com.google.cloud.translate.v3beta1.LocationName)10 TranslationServiceClient (com.google.cloud.translate.v3beta1.TranslationServiceClient)10 Model (com.google.cloud.automl.v1.Model)8 LocationName (com.google.cloud.bigquery.connection.v1.LocationName)8 Dataset (com.google.cloud.automl.v1.Dataset)7 Dataset (com.google.cloud.automl.v1beta1.Dataset)6 CloudTasksClient (com.google.cloud.tasks.v2.CloudTasksClient)5