test_connect_with_unused_process Subroutine

public subroutine test_connect_with_unused_process(this)

Arguments

Type IntentOptional Attributes Name
class(MpiTestMethod), intent(inout) :: this

Calls

proc~~test_connect_with_unused_process~~CallsGraph proc~test_connect_with_unused_process test_connect_with_unused_process assertequal assertequal proc~test_connect_with_unused_process->assertequal getmpicommunicator getmpicommunicator proc~test_connect_with_unused_process->getmpicommunicator getprocessrank getprocessrank proc~test_connect_with_unused_process->getprocessrank mpi_comm_split mpi_comm_split proc~test_connect_with_unused_process->mpi_comm_split none~connect_to_client~2 DirectoryService%connect_to_client proc~test_connect_with_unused_process->none~connect_to_client~2 none~connect_to_server~2 DirectoryService%connect_to_server proc~test_connect_with_unused_process->none~connect_to_server~2 none~free_directory_resources~2 DirectoryService%free_directory_resources proc~test_connect_with_unused_process->none~free_directory_resources~2 none~publish~2 DirectoryService%publish proc~test_connect_with_unused_process->none~publish~2

Source Code

   subroutine test_connect_with_unused_process(this)
      class (MpiTestMethod), intent(inout) :: this

      type (DirectoryService) :: ds
      integer :: comm

      integer :: color, key
      integer :: ierror
      type (MockServer) :: mock_server
      type (MockClient) :: mock_client

      ds = DirectoryService(this%getMpiCommunicator())

      if (this%getProcessRank() == 3) then
         color = 5
      else
         color = this%getProcessRank()/3
         key = 0
      end if
      call MPI_Comm_split(this%getMpiCommunicator(), color, key, comm, ierror)
      @assertEqual(0, ierror)

      select case (color)
      case (1) ! server
         mock_server = MockServer(comm)
         call ds%publish(PortInfo('input', mock_server), mock_server)

         select case (this%getProcessRank())
         case (4) ! have one
            call ds%connect_to_client('input', mock_server)
         case (5)
            call ds%connect_to_client('input', mock_server)
         end select
      case (0) ! client
         mock_client = MockClient()
         call ds%connect_to_server('input', mock_client, comm)
      end select

      call ds%free_directory_resources()

   end subroutine test_connect_with_unused_process