@@ -296,6 +296,37 @@ 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 = new InstanceAdminClientImpl (projectIdWithOrg , rpc , dbClient );
306+ com .google .spanner .admin .instance .v1 .Instance instance = com .google .spanner .admin .instance .v1 .Instance .newBuilder ()
307+ .setConfig (configNameWithOrg )
308+ .setName (instanceNameWithOrg )
309+ .setNodeCount (1 )
310+ .setProcessingUnits (0 )
311+ .setEdition (com .google .spanner .admin .instance .v1 .Instance .Edition .ENTERPRISE_PLUS )
312+ .build ();
313+ OperationFuture <com .google .spanner .admin .instance .v1 .Instance , CreateInstanceMetadata >
314+ rawOperationFuture =
315+ OperationFutureUtil .immediateOperationFuture (
316+ "createInstance" , instance , CreateInstanceMetadata .getDefaultInstance ());
317+ when (rpc .createInstance ("projects/" + projectIdWithOrg , INSTANCE_ID , instance ))
318+ .thenReturn (rawOperationFuture );
319+ OperationFuture <Instance , CreateInstanceMetadata > op =
320+ universeClient .createInstance (
321+ InstanceInfo .newBuilder (InstanceId .of (projectIdWithOrg , INSTANCE_ID ))
322+ .setInstanceConfigId (InstanceConfigId .of (projectIdWithOrg , CONFIG_ID ))
323+ .setEdition (com .google .spanner .admin .instance .v1 .Instance .Edition .ENTERPRISE_PLUS )
324+ .setNodeCount (1 )
325+ .build ());
326+ assertThat (op .isDone ()).isTrue ();
327+ assertThat (op .get ().getId ().getName ()).isEqualTo (instanceNameWithOrg );
328+ }
329+
299330 @ Test
300331 public void testCreateInstanceWithProcessingUnits () throws Exception {
301332 OperationFuture <com .google .spanner .admin .instance .v1 .Instance , CreateInstanceMetadata >
0 commit comments