PeerConfigurationDecorator implements PeerConfiguration { public boolean equals(Object other) { if(!(other instanceof PeerConfiguration)) return false; PeerConfiguration o = (PeerConfiguration)other; return (new EqualsBuilder()) .append(getAutomaticStartInterval(), o.getAutomaticStartInterval()) .append(getCapabilities(), o.getCapabilities()) .append(getClientConfig(), o.getClientConfig()) .append(getIdleHoldTime(), o.getIdleHoldTime()) .append(getHoldTime(), o.getHoldTime()) .append(getLocalAS(), o.getLocalAS()) .append(getLocalBgpIdentifier(), o.getLocalBgpIdentifier()) .append(getPeerName(), o.getPeerName()) .append(getRemoteAS(), o.getRemoteAS()) .append(getRemoteBgpIdentifier(), o.getRemoteBgpIdentifier()) .append(getDelayOpenTime(), o.getDelayOpenTime()) .append(isAllowAutomaticStart(), o.isAllowAutomaticStart()) .append(isAllowAutomaticStop(), o.isAllowAutomaticStop()) .append(isCollisionDetectEstablishedState(), o.isCollisionDetectEstablishedState()) .append(isDampPeerOscillation(), o.isDampPeerOscillation()) .append(isDelayOpen(), o.isDelayOpen()) .append(isHoldTimerDisabled(), o.isHoldTimerDisabled()) .append(isPassiveTcpEstablishment(), o.isPassiveTcpEstablishment()) .append(getConnectRetryTime(), o.getConnectRetryTime()) .isEquals(); } protected  PeerConfigurationDecorator(PeerConfiguration decorated); ClientConfiguration getClientConfig(); int getLocalAS(); int getRemoteAS(); String getPeerName(); long getRemoteBgpIdentifier(); long getLocalBgpIdentifier(); int getHoldTime(); int getIdleHoldTime(); boolean isAllowAutomaticStart(); boolean isAllowAutomaticStop(); boolean isDampPeerOscillation(); boolean isPassiveTcpEstablishment(); boolean isDelayOpen(); int getDelayOpenTime(); boolean isCollisionDetectEstablishedState(); boolean equals(Object other); int hashCode(); int getConnectRetryTime(); @Override int getAutomaticStartInterval(); boolean isHoldTimerDisabled(); @Override Capabilities getCapabilities();  }
@Test public void testEquals() throws Exception { PeerConfiguration cd1 = 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 cp1 = new MockPeerConfgurationDecorator(cd1); PeerConfiguration cd2 = 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 cp2 = new MockPeerConfgurationDecorator(cd2); PeerConfiguration cd3 = 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 cp3 = new MockPeerConfgurationDecorator(cd3); PeerConfiguration cd4 = 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 cp4 = new MockPeerConfgurationDecorator(cd4); PeerConfiguration cd5 = 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 cp5 = new MockPeerConfgurationDecorator(cd5); PeerConfiguration cd6 = 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 cp6 = new MockPeerConfgurationDecorator(cd6); PeerConfiguration cd7 = 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 cp7 = new MockPeerConfgurationDecorator(cd7); PeerConfiguration cd8 = 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 cp8 = new MockPeerConfgurationDecorator(cd8); PeerConfiguration cd9 = 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, false); PeerConfiguration cp9 = new MockPeerConfgurationDecorator(cd9); PeerConfiguration cd10 = 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 cp10 = new MockPeerConfgurationDecorator(cd10); PeerConfiguration cd11 = 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 cp11 = new MockPeerConfgurationDecorator(cd11); PeerConfiguration cd12 = 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 cp12 = new MockPeerConfgurationDecorator(cd12); PeerConfiguration cd13 = 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 cp13 = new MockPeerConfgurationDecorator(cd13); PeerConfiguration cd14 = 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 cp14 = new MockPeerConfgurationDecorator(cd14); PeerConfiguration cd15 = 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 cp15 = new MockPeerConfgurationDecorator(cd15); PeerConfiguration cd16 = 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 cp16 = new MockPeerConfgurationDecorator(cd16); PeerConfiguration cd17 = 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 cp17 = new MockPeerConfgurationDecorator(cd17); PeerConfiguration cd18 = 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 cp18 = new MockPeerConfgurationDecorator(cd18); PeerConfiguration cd19 = 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, 181, false); PeerConfiguration cp19 = new MockPeerConfgurationDecorator(cd19); PeerConfiguration cd20 = 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 cp20 = new MockPeerConfgurationDecorator(cd20); Assert.assertTrue(cp1.equals(cp2)); Assert.assertFalse(cp1.equals(cp3)); Assert.assertFalse(cp1.equals(cp4)); Assert.assertFalse(cp1.equals(cp5)); Assert.assertFalse(cp1.equals(cp6)); Assert.assertFalse(cp1.equals(cp7)); Assert.assertFalse(cp1.equals(cp8)); Assert.assertFalse(cp1.equals(cp9)); Assert.assertFalse(cp1.equals(cp10)); Assert.assertFalse(cp1.equals(cp11)); Assert.assertFalse(cp1.equals(cp12)); Assert.assertFalse(cp1.equals(cp13)); Assert.assertFalse(cp1.equals(cp14)); Assert.assertFalse(cp1.equals(cp15)); Assert.assertFalse(cp1.equals(cp16)); Assert.assertFalse(cp1.equals(cp17)); Assert.assertFalse(cp1.equals(cp18)); Assert.assertFalse(cp1.equals(cp19)); Assert.assertFalse(cp1.equals(cp20)); Assert.assertTrue(cp1.equals(cd1)); Assert.assertTrue(cp2.equals(cd2)); Assert.assertTrue(cp3.equals(cd3)); Assert.assertTrue(cp4.equals(cd4)); Assert.assertTrue(cp5.equals(cd5)); Assert.assertTrue(cp6.equals(cd6)); Assert.assertTrue(cp7.equals(cd7)); Assert.assertTrue(cp8.equals(cd8)); Assert.assertTrue(cp9.equals(cd9)); Assert.assertTrue(cp10.equals(cd10)); Assert.assertTrue(cp11.equals(cd11)); Assert.assertTrue(cp12.equals(cd12)); Assert.assertTrue(cp13.equals(cd13)); Assert.assertTrue(cp14.equals(cd14)); Assert.assertTrue(cp15.equals(cd15)); Assert.assertTrue(cp16.equals(cd16)); Assert.assertTrue(cp17.equals(cd17)); Assert.assertTrue(cp18.equals(cd18)); Assert.assertTrue(cp19.equals(cd19)); Assert.assertTrue(cp20.equals(cd20)); }