@@ -296,6 +296,39 @@ public void createInstance() throws Exception {
296296 assertThat (op .get ().getId ().getName ()).isEqualTo (INSTANCE_NAME );
297297 }
298298
299+ @ Test
300+ public void createInstanceWithOrgNameInProjectId () throws Exception {
301+ String projectIdWithOrg = "my-org:my-project" ;
302+ String instanceNameWithOrg = "projects/my-org:my-project/instances/my-instance" ;
303+ String configNameWithOrg = "projects/my-org:my-project/instanceConfigs/my-config" ;
304+
305+ InstanceAdminClient universeClient =
306+ new InstanceAdminClientImpl (projectIdWithOrg , rpc , dbClient );
307+ com .google .spanner .admin .instance .v1 .Instance instance =
308+ com .google .spanner .admin .instance .v1 .Instance .newBuilder ()
309+ .setConfig (configNameWithOrg )
310+ .setName (instanceNameWithOrg )
311+ .setNodeCount (1 )
312+ .setProcessingUnits (0 )
313+ .setEdition (com .google .spanner .admin .instance .v1 .Instance .Edition .ENTERPRISE_PLUS )
314+ .build ();
315+ OperationFuture <com .google .spanner .admin .instance .v1 .Instance , CreateInstanceMetadata >
316+ rawOperationFuture =
317+ OperationFutureUtil .immediateOperationFuture (
318+ "createInstance" , instance , CreateInstanceMetadata .getDefaultInstance ());
319+ when (rpc .createInstance ("projects/" + projectIdWithOrg , INSTANCE_ID , instance ))
320+ .thenReturn (rawOperationFuture );
321+ OperationFuture <Instance , CreateInstanceMetadata > op =
322+ universeClient .createInstance (
323+ InstanceInfo .newBuilder (InstanceId .of (projectIdWithOrg , INSTANCE_ID ))
324+ .setInstanceConfigId (InstanceConfigId .of (projectIdWithOrg , CONFIG_ID ))
325+ .setEdition (com .google .spanner .admin .instance .v1 .Instance .Edition .ENTERPRISE_PLUS )
326+ .setNodeCount (1 )
327+ .build ());
328+ assertThat (op .isDone ()).isTrue ();
329+ assertThat (op .get ().getId ().getName ()).isEqualTo (instanceNameWithOrg );
330+ }
331+
299332 @ Test
300333 public void testCreateInstanceWithProcessingUnits () throws Exception {
301334 OperationFuture <com .google .spanner .admin .instance .v1 .Instance , CreateInstanceMetadata >
0 commit comments