test_connect Subroutine

public subroutine test_connect(this)

Arguments

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

Calls

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

Source Code

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

      type (DirectoryService) :: ds
      integer :: comm

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

      ds = DirectoryService(this%getMpiCommunicator())
      color = this%getProcessRank()
      key = 0
      call MPI_Comm_split(this%getMpiCommunicator(), color, key, comm, ierror)
      @assertEqual(0, ierror)

      select case (this%getProcessRank())
      case (0) ! server
         mock_server = MockServer(comm)
         call ds%publish(PortInfo('input', mock_server), mock_server)
         call ds%connect_to_client('input', mock_server)
      case (1) ! client
         mock_client = MockClient()
         call ds%connect_to_server('input', mock_client, comm)
      end select

!C$      select type (s)
!C$      type is (MpiSocket)
!C$      class default
!C$         @assertTrue(.false.)
!C$      end select

      call ds%free_directory_resources()

   end subroutine test_connect