File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
iot/api-client/manager/src/test/java/com/example/cloud/iot/examples Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public class ManagerIT {
5555 private static final String CLOUD_REGION = "us-central1" ;
5656 private static final String ES_PATH = "resources/ec_public.pem" ;
5757 private static final String PROJECT_ID = System .getenv ("GOOGLE_CLOUD_PROJECT" );
58- private static final String REGISTRY_ID = "java-reg" + (System .currentTimeMillis () / 100L );
58+ private static final String REGISTRY_ID = "java-reg- " + (System .currentTimeMillis () / 100L );
5959 private static final String RSA_PATH = "resources/rsa_cert.pem" ;
6060 private static final String PKCS_PATH = "resources/rsa_private_pkcs8" ;
6161 private static final String TOPIC_ID = "java-pst-" + (System .currentTimeMillis () / 100L );
@@ -115,6 +115,16 @@ public void clearTestRegistries() throws Exception {
115115 DeviceRegistryExample .clearRegistry (CLOUD_REGION , PROJECT_ID , registryId );
116116 }
117117 }
118+ // Also remove the current test registry
119+ try {
120+ DeviceRegistryExample .clearRegistry (CLOUD_REGION , PROJECT_ID , REGISTRY_ID );
121+ } catch (com .google .api .client .googleapis .json .GoogleJsonResponseException gjre ) {
122+ if (gjre .getStatusCode () == 404 ) {
123+ // Expected, the registry resource is available for creation.
124+ } else {
125+ throw gjre ;
126+ }
127+ }
118128 }
119129 } else {
120130 System .out .println ("Project has no registries." );
You can’t perform that action at this time.
0 commit comments