PeerConfigurationImpl implements PeerConfiguration { @Override public boolean equals(Object obj) { if(!PeerConfiguration.class.isAssignableFrom(obj.getClass())) return false; PeerConfiguration o = (PeerConfiguration)obj; return (new EqualsBuilder()) .append(allowAutomaticStart, o.isAllowAutomaticStart()) .append(allowAutomaticStop, o.isAllowAutomaticStop()) .append(automaticStartInterval, o.getAutomaticStartInterval()) .append(capabilities, o.getCapabilities()) .append(clientConfig, o.getClientConfig()) .append(collisionDetectEstablishedState, o.isCollisionDetectEstablishedState()) .append(connectRetryTime, o.getConnectRetryTime()) .append(dampPeerOscillation, o.isDampPeerOscillation()) .append(delayOpen, o.isDelayOpen()) .append(delayOpenTime, o.getDelayOpenTime()) .append(holdTime, o.getHoldTime()) .append(holdTimerDisabled, o.isHoldTimerDisabled()) .append(idleHoldTime, o.getIdleHoldTime()) .append(localAS, o.getLocalAS()) .append(localBgpIdentifier, o.getLocalBgpIdentifier()) .append(passiveTcpEstablishment, o.isPassiveTcpEstablishment()) .append(peerName, o.getPeerName()) .append(remoteAS, o.getRemoteAS()) .append(remoteBgpIdentifier, o.getRemoteBgpIdentifier()) .isEquals(); } PeerConfigurationImpl();  PeerConfigurationImpl(String peerName, ClientConfiguration clientConfig);  PeerConfigurationImpl(String peerName, ClientConfiguration clientConfig, int localAS, int remoteAS);  PeerConfigurationImpl(String peerName, ClientConfiguration clientConfig, int localAS, int remoteAS, 
			long localBgpIdentifier, long remoteBgpIdentifier);  PeerConfigurationImpl(String peerName, ClientConfiguration clientConfig, int localAS, int remoteAS, 
			long localBgpIdentifier, long remoteBgpIdentifier, int connectRetryTime);  PeerConfigurationImpl(String peerName, ClientConfiguration clientConfig, int localAS, int remoteAS, 
			long localBgpIdentifier, long remoteBgpIdentifier, int connectRetryTime, int holdTime, boolean holdTimerDisabled, int idleHoldTime);  PeerConfigurationImpl(String peerName, ClientConfiguration clientConfig, int localAS, int remoteAS, 
			long localBgpIdentifier, long remoteBgpIdentifier, int connectRetryTime, int holdTime, boolean holdTimerDisabled, int idleHoldTime,
			boolean allowAutomaticStart, boolean allowAutomaticStop, int automaticStartInterval, boolean dampPeerOscillation);  PeerConfigurationImpl(String peerName, ClientConfiguration clientConfig, int localAS, int remoteAS, 
			long localBgpIdentifier, long remoteBgpIdentifier, int connectRetryTime, int holdTime, boolean holdTimerDisabled, int idleHoldTime,
			boolean allowAutomaticStart, boolean allowAutomaticStop, int automaticStartInterval, boolean dampPeerOscillation,
			boolean passiveTcpEstablishment, boolean delayOpen, int delayOpenTime);  PeerConfigurationImpl(String peerName, ClientConfiguration clientConfig, int localAS, int remoteAS, 
			long localBgpIdentifier, long remoteBgpIdentifier, int connectRetryTime, int holdTime, boolean holdTimerDisabled, int idleHoldTime,
			boolean allowAutomaticStart, boolean allowAutomaticStop, int automaticStartInterval, boolean dampPeerOscillation,
			boolean passiveTcpEstablishment, boolean delayOpen, int delayOpenTime,
			boolean collisionDetectEstablishedState);  PeerConfigurationImpl(String peerName, ClientConfiguration clientConfig, int localAS, int remoteAS, 
			long localBgpIdentifier, long remoteBgpIdentifier, int connectRetryTime, int holdTime, boolean holdTimerDisabled, int idleHoldTime,
			boolean allowAutomaticStart, boolean allowAutomaticStop, int automaticStartInterval, boolean dampPeerOscillation,
			boolean passiveTcpEstablishment, boolean delayOpen, int delayOpenTime,
			boolean collisionDetectEstablishedState, Capabilities capabilities); @Override ClientConfiguration getClientConfig(); @Override int getLocalAS(); @Override int getRemoteAS(); @Override String getPeerName(); long getLocalBgpIdentifier(); long getRemoteBgpIdentifier(); int getHoldTime(); int getIdleHoldTime(); @Override int hashCode(); @Override boolean equals(Object obj); boolean isAllowAutomaticStart(); boolean isAllowAutomaticStop(); boolean isCollisionDetectEstablishedState(); boolean isDampPeerOscillation(); boolean isDelayOpen(); boolean isPassiveTcpEstablishment(); int getDelayOpenTime(); int getConnectRetryTime(); int getAutomaticStartInterval(); boolean isHoldTimerDisabled(); Capabilities getCapabilities();  }
@Test public void testEquals() throws Exception { PeerConfiguration c1 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration c2 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration c3 = new PeerConfigurationImpl("bar", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration c4 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.5.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration c5 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24577, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration c6 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32769, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration c7 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80402L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration c8 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80502L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration c9 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 301, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration c10 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, true, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration c11 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 31, false, false, 0, false, false, false, 180, false); PeerConfiguration c12 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, true, false, 0, false, false, false, 180, false); PeerConfiguration c13 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, true, 0, false, false, false, 180, false); PeerConfiguration c14 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 10, false, false, false, 180, false); PeerConfiguration c15 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, true, false, false, 180, false); PeerConfiguration c16 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, true, false, 180, false); PeerConfiguration c17 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, true, 180, false); PeerConfiguration c18 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 240, false); PeerConfiguration c19 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, true); PeerConfiguration c20 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 61, 300, false, 30, false, false, 0, false, false, false, 180, true); PeerConfiguration c21 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false, new CapabilitiesImpl(new Capability[] { new AutonomousSystem4Capability(16) })); PeerConfiguration c22 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false, new CapabilitiesImpl(new Capability[] { new AutonomousSystem4Capability(16), new MultiProtocolCapability(AddressFamily.IPv4, SubsequentAddressFamily.NLRI_UNICAST_FORWARDING) })); Assert.assertTrue(c1.equals(c2)); Assert.assertFalse(c1.equals(c3)); Assert.assertFalse(c1.equals(c4)); Assert.assertFalse(c1.equals(c5)); Assert.assertFalse(c1.equals(c6)); Assert.assertFalse(c1.equals(c7)); Assert.assertFalse(c1.equals(c8)); Assert.assertFalse(c1.equals(c9)); Assert.assertFalse(c1.equals(c10)); Assert.assertFalse(c1.equals(c11)); Assert.assertFalse(c1.equals(c12)); Assert.assertFalse(c1.equals(c13)); Assert.assertFalse(c1.equals(c14)); Assert.assertFalse(c1.equals(c15)); Assert.assertFalse(c1.equals(c16)); Assert.assertFalse(c1.equals(c17)); Assert.assertFalse(c1.equals(c18)); Assert.assertFalse(c1.equals(c19)); Assert.assertFalse(c1.equals(c20)); Assert.assertFalse(c1.equals(c21)); Assert.assertFalse(c1.equals(c22)); Assert.assertFalse(c21.equals(c20)); }