Exemplo n.º 1
0
 /** Tests serializing and deserializing a member. */
 public void testSerializeDeserialize() {
   ServerMember member =
       new ServerMember(Member.Type.ACTIVE, new Address("localhost", 5000), null);
   Serializer serializer =
       new Serializer().resolve(new SessionTypeResolver(), new StateTypeResolver());
   ServerMember result = serializer.readObject(serializer.writeObject(member).flip());
   assertEquals(result.type(), member.type());
 }
Exemplo n.º 2
0
 /** Tests member getters. */
 public void testMemberGetters() {
   ServerMember member =
       new ServerMember(
           Member.Type.ACTIVE, new Address("localhost", 5000), new Address("localhost", 6000));
   assertEquals(member.type(), Member.Type.ACTIVE);
   assertEquals(member.status(), ServerMember.Status.AVAILABLE);
   assertEquals(member.serverAddress(), new Address("localhost", 5000));
   assertEquals(member.clientAddress(), new Address("localhost", 6000));
 }
Exemplo n.º 3
0
 /** Tests updating a member. */
 public void testMemberUpdate() {
   ServerMember member =
       new ServerMember(Member.Type.ACTIVE, new Address("localhost", 5000), null);
   member.update(Member.Type.INACTIVE);
   assertEquals(member.type(), Member.Type.INACTIVE);
   member.update(ServerMember.Status.UNAVAILABLE);
   assertEquals(member.status(), ServerMember.Status.UNAVAILABLE);
   assertNull(member.clientAddress());
   member.update(new Address("localhost", 6000));
   assertEquals(member.clientAddress(), new Address("localhost", 6000));
 }