예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void joinDeniedTimeoutShouldBeHandledWithExceptionIncludingConfiguration() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void JoinDeniedTimeoutShouldBeHandledWithExceptionIncludingConfiguration()
        {
            // GIVEN
            ClusterContext context = mock(typeof(ClusterContext));
            IDictionary <InstanceId, URI> existingMembers = Members(1, 2);

            when(context.GetLog(any(typeof(Type)))).thenReturn(NullLog.Instance);
            when(context.JoiningInstances).thenReturn(Collections.emptyList());
            when(context.HasJoinBeenDenied()).thenReturn(true);
            when(context.JoinDeniedConfigurationResponseState).thenReturn(ConfigurationResponseState(existingMembers));
            TrackingMessageHolder outgoing = new TrackingMessageHolder();

            // WHEN the join denial actually takes effect (signaled by a join timeout locally)
            ClusterState.Joining.handle(context, to(ClusterMessage.JoiningTimeout, Uri(2)).setHeader(Message.HEADER_CONVERSATION_ID, "bla"), outgoing);

            // THEN assert that the failure contains the received configuration
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.cluster.com.message.Message<? extends org.neo4j.cluster.com.message.MessageType> response = outgoing.single();
            Message <MessageType>       response        = outgoing.Single();
            ClusterEntryDeniedException deniedException = response.Payload;

            assertEquals(existingMembers, deniedException.ConfigurationResponseState.Members);
        }