test_class.file: cosmic-core/server/src/test/java/com/cloud/api/dispatch/CommandCreationWorkerTest.java
test_class.identifier: CommandCreationWorkerTest
test_case.body: @Test
      public void testHandle() throws ResourceAllocationException {
          // Prepare
          final BaseAsyncCreateCmd asyncCreateCmd = mock(BaseAsyncCreateCmd.class);
          final Map<String, String> params = new HashMap<>();
          final Account account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
          final UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN);
          CallContext.register(user, account);
  
          // Execute
          final CommandCreationWorker creationWorker = new CommandCreationWorker();
  
          creationWorker.handle(new DispatchTask(asyncCreateCmd, params));
  
          // Assert
          verify(asyncCreateCmd, times(1)).create();
      }
test_case.class_method_signature: CommandCreationWorkerTest.testHandle()
test_case.full_signature: @Test public void testHandle()
test_case.identifier: testHandle
test_case.invocations: mock toString randomUUID register handle create verify times
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testHandle()
focal_class.declarator: ATTEMP_TO_CREATE_NON_CREATION_CMD =
              "Trying to invoke creation on a Command that is not " +
                      BaseAsyncCreateCmd.class.getName()
focal_class.modifier: private static final
focal_class.original_string: private static final String ATTEMP_TO_CREATE_NON_CREATION_CMD =
              "Trying to invoke creation on a Command that is not " +
                      BaseAsyncCreateCmd.class.getName();
focal_class.type: String
focal_class.var_name: ATTEMP_TO_CREATE_NON_CREATION_CMD
focal_class.file: cosmic-core/server/src/main/java/com/cloud/api/dispatch/CommandCreationWorker.java
focal_class.identifier: CommandCreationWorker
focal_class.interfaces: implements DispatchWorker
focal_class.class_method_signature: CommandCreationWorker.handle(final DispatchTask task)
focal_class.full_signature: @Override public void handle(final DispatchTask task)
focal_class.identifier: handle
focal_class.modifiers: @Override public
focal_class.parameters: (final DispatchTask task)
focal_class.return: void
focal_class.signature: void handle(final DispatchTask task)
focal_method.body: @Override
      public void handle(final DispatchTask task) {
          final BaseCmd cmd = task.getCmd();
  
          if (cmd instanceof BaseAsyncCreateCmd) {
              try {
                  CallContext.current().setEventDisplayEnabled(cmd.isDisplay());
                  ((BaseAsyncCreateCmd) cmd).create();
              } catch (final ResourceAllocationException e) {
                  throw new ServerApiException(ApiErrorCode.RESOURCE_ALLOCATION_ERROR,
                          e.getMessage(), e);
              }
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
                      ATTEMP_TO_CREATE_NON_CREATION_CMD);
          }
      }
focal_method.class_method_signature: CommandCreationWorker.handle(final DispatchTask task)
focal_method.full_signature: @Override public void handle(final DispatchTask task)
focal_method.identifier: handle
focal_method.invocations: getCmd setEventDisplayEnabled current isDisplay create getMessage
focal_method.modifiers: @Override public
focal_method.parameters: (final DispatchTask task)
focal_method.return: void
focal_method.signature: void handle(final DispatchTask task)