test_class.declarator: SCHEMA_PATTERN = "schema_%s"
test_class.modifier: private static final
test_class.original_string: private static final String SCHEMA_PATTERN = "schema_%s";
test_class.type: String
test_class.var_name: SCHEMA_PATTERN
test_class.declarator: backendConnection
test_class.modifier: private
test_class.original_string: private BackendConnection backendConnection;
test_class.type: BackendConnection
test_class.var_name: backendConnection
test_class.file: shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/UseDatabaseBackendHandlerTest.java
test_class.identifier: UseDatabaseBackendHandlerTest
test_case.body: @Test
      public void assertExecuteUseStatementBackendHandler() {
          MySQLUseStatement useStatement = mock(MySQLUseStatement.class);
          when(useStatement.getSchema()).thenReturn(String.format(SCHEMA_PATTERN, 0));
          UseDatabaseBackendHandler useSchemaBackendHandler = new UseDatabaseBackendHandler(useStatement, backendConnection);
          BackendResponse actual = useSchemaBackendHandler.execute();
          verify(backendConnection).setCurrentSchema(anyString());
          assertThat(actual, instanceOf(UpdateResponse.class));
      }
test_case.class_method_signature: UseDatabaseBackendHandlerTest.assertExecuteUseStatementBackendHandler()
test_case.full_signature: @Test public void assertExecuteUseStatementBackendHandler()
test_case.identifier: assertExecuteUseStatementBackendHandler
test_case.invocations: mock thenReturn when getSchema format execute setCurrentSchema verify anyString assertThat instanceOf
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertExecuteUseStatementBackendHandler()
focal_class.declarator: useStatement
focal_class.modifier: private final
focal_class.original_string: private final MySQLUseStatement useStatement;
focal_class.type: MySQLUseStatement
focal_class.var_name: useStatement
focal_class.declarator: backendConnection
focal_class.modifier: private final
focal_class.original_string: private final BackendConnection backendConnection;
focal_class.type: BackendConnection
focal_class.var_name: backendConnection
focal_class.file: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/UseDatabaseBackendHandler.java
focal_class.identifier: UseDatabaseBackendHandler
focal_class.interfaces: implements TextProtocolBackendHandler
focal_class.class_method_signature: UseDatabaseBackendHandler.execute()
focal_class.full_signature: @Override public BackendResponse execute()
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: BackendResponse
focal_class.signature: BackendResponse execute()
focal_class.class_method_signature: UseDatabaseBackendHandler.isAuthorizedSchema(final String schema)
focal_class.full_signature: private boolean isAuthorizedSchema(final String schema)
focal_class.identifier: isAuthorizedSchema
focal_class.modifiers: private
focal_class.parameters: (final String schema)
focal_class.return: boolean
focal_class.signature: boolean isAuthorizedSchema(final String schema)
focal_class.class_method_signature: UseDatabaseBackendHandler.next()
focal_class.full_signature: @Override public boolean next()
focal_class.identifier: next
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean next()
focal_class.class_method_signature: UseDatabaseBackendHandler.getQueryData()
focal_class.full_signature: @Override public QueryData getQueryData()
focal_class.identifier: getQueryData
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: QueryData
focal_class.signature: QueryData getQueryData()
focal_method.body: @Override
      public BackendResponse execute() {
          String schema = SQLUtil.getExactlyValue(useStatement.getSchema());
          if (ProxyContext.getInstance().schemaExists(schema) && isAuthorizedSchema(schema)) {
              backendConnection.setCurrentSchema(schema);
              return new UpdateResponse();
          }
          throw new UnknownDatabaseException(schema);
          
      }
focal_method.class_method_signature: UseDatabaseBackendHandler.execute()
focal_method.full_signature: @Override public BackendResponse execute()
focal_method.identifier: execute
focal_method.invocations: getExactlyValue getSchema schemaExists getInstance isAuthorizedSchema setCurrentSchema
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: BackendResponse
focal_method.signature: BackendResponse execute()