コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void aClusterSnapshotShouldEqualItsOrigin() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void AClusterSnapshotShouldEqualItsOrigin()
        {
            // Given
            ClusterConfiguration config = new ClusterConfiguration("default", NullLogProvider.Instance, "cluster://localhost:5001", "cluster://localhost:5002", "cluster://localhost:5003");

            ClusterState state = new ClusterState(new IList <ClusterInstance> {
                newClusterInstance(new InstanceId(1), new URI("cluster://localhost:5001"), new Monitors(), config, 10, NullLogProvider.Instance), newClusterInstance(new InstanceId(2), new URI("cluster://localhost:5002"), new Monitors(), config, 10, NullLogProvider.Instance), newClusterInstance(new InstanceId(3), new URI("cluster://localhost:5003"), new Monitors(), config, 10, NullLogProvider.Instance)
            }, emptySet());

            // When
            ClusterState snapshot = state.Snapshot();

            // Then
            assertEquals(state, snapshot);
            assertEquals(state.GetHashCode(), snapshot.GetHashCode());
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void twoStatesWithSameSetupAndPendingMessagesShouldBeEqual() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TwoStatesWithSameSetupAndPendingMessagesShouldBeEqual()
        {
            // Given
            ClusterConfiguration config = new ClusterConfiguration("default", NullLogProvider.Instance, "cluster://localhost:5001", "cluster://localhost:5002", "cluster://localhost:5003");

            ClusterState state = new ClusterState(new IList <ClusterInstance> {
                newClusterInstance(new InstanceId(1), new URI("cluster://localhost:5001"), new Monitors(), config, 10, NullLogProvider.Instance), newClusterInstance(new InstanceId(2), new URI("cluster://localhost:5002"), new Monitors(), config, 10, NullLogProvider.Instance), newClusterInstance(new InstanceId(3), new URI("cluster://localhost:5003"), new Monitors(), config, 10, NullLogProvider.Instance)
            }, emptySet());

            // When
            ClusterState firstState = state.PerformAction(new MessageDeliveryAction(Message.to(ClusterMessage.join, new URI("cluster://localhost:5002"), new object[]
            {
                "defaultcluster", new URI[] { new URI("cluster://localhost:5003") }
            }).setHeader(Message.HEADER_CONVERSATION_ID, "-1").setHeader(Message.HEADER_FROM, "cluster://localhost:5002")));
            ClusterState secondState = state.PerformAction(new MessageDeliveryAction(Message.to(ClusterMessage.join, new URI("cluster://localhost:5002"), new object[]
            {
                "defaultcluster", new URI[] { new URI("cluster://localhost:5003") }
            }).setHeader(Message.HEADER_CONVERSATION_ID, "-1").setHeader(Message.HEADER_FROM, "cluster://localhost:5002")));

            // Then
            assertEquals(firstState, secondState);
            assertEquals(firstState.GetHashCode(), secondState.GetHashCode());
        }