@Test public void testArePeers() { TransitGatewayAttachment attachment1 = new TransitGatewayAttachment( "attach", "tgw", "myAcc", ResourceType.PEERING, "resId", "resAcc", null); assertTrue( "matching peers", arePeers( attachment1, new TransitGatewayAttachment( "attach", "resId", "resAcc", ResourceType.PEERING, "tgw", "myAcc", null))); assertFalse( "wrong attachment id", arePeers( attachment1, new TransitGatewayAttachment( "other", "resId", "resAcc", ResourceType.PEERING, "tgw", "myAcc", null))); assertFalse( "wrong gateway id", arePeers( attachment1, new TransitGatewayAttachment( "attach", "other", "resAcc", ResourceType.PEERING, "tgw", "myAcc", null))); assertFalse( "wrong gateway owner (acccount) id", arePeers( attachment1, new TransitGatewayAttachment( "attach", "resId", "other", ResourceType.PEERING, "tgw", "myAcc", null))); assertFalse( "wrong resource id ", arePeers( attachment1, new TransitGatewayAttachment( "attach", "resId", "resAcc", ResourceType.PEERING, "other", "myAcc", null))); assertFalse( "wrong resource owner id ", arePeers( attachment1, new TransitGatewayAttachment( "attach", "resId", "resAcc", ResourceType.PEERING, "tgw", "other", null))); }
@VisibleForTesting static boolean arePeers( TransitGatewayAttachment attachment1, TransitGatewayAttachment attachment2) { return attachment1.getResourceType() == ResourceType.PEERING && attachment2.getResourceType() == ResourceType.PEERING && attachment1.getId().equals(attachment2.getId()) && attachment1.getGatewayOwnerId().equals(attachment2.getResourceOwnerId()) && attachment1.getResourceOwnerId().equals(attachment2.getGatewayOwnerId()) && attachment1.getGatewayId().equals(attachment2.getResourceId()) && attachment1.getResourceId().equals(attachment2.getGatewayId()); }
TransitGatewayPeeringConnector { @VisibleForTesting static boolean arePeers( TransitGatewayAttachment attachment1, TransitGatewayAttachment attachment2) { return attachment1.getResourceType() == ResourceType.PEERING && attachment2.getResourceType() == ResourceType.PEERING && attachment1.getId().equals(attachment2.getId()) && attachment1.getGatewayOwnerId().equals(attachment2.getResourceOwnerId()) && attachment1.getResourceOwnerId().equals(attachment2.getGatewayOwnerId()) && attachment1.getGatewayId().equals(attachment2.getResourceId()) && attachment1.getResourceId().equals(attachment2.getGatewayId()); } }
TransitGatewayPeeringConnector { @VisibleForTesting static boolean arePeers( TransitGatewayAttachment attachment1, TransitGatewayAttachment attachment2) { return attachment1.getResourceType() == ResourceType.PEERING && attachment2.getResourceType() == ResourceType.PEERING && attachment1.getId().equals(attachment2.getId()) && attachment1.getGatewayOwnerId().equals(attachment2.getResourceOwnerId()) && attachment1.getResourceOwnerId().equals(attachment2.getGatewayOwnerId()) && attachment1.getGatewayId().equals(attachment2.getResourceId()) && attachment1.getResourceId().equals(attachment2.getGatewayId()); }  }
TransitGatewayPeeringConnector { @VisibleForTesting static boolean arePeers( TransitGatewayAttachment attachment1, TransitGatewayAttachment attachment2) { return attachment1.getResourceType() == ResourceType.PEERING && attachment2.getResourceType() == ResourceType.PEERING && attachment1.getId().equals(attachment2.getId()) && attachment1.getGatewayOwnerId().equals(attachment2.getResourceOwnerId()) && attachment1.getResourceOwnerId().equals(attachment2.getGatewayOwnerId()) && attachment1.getGatewayId().equals(attachment2.getResourceId()) && attachment1.getResourceId().equals(attachment2.getGatewayId()); }  static void connect(
      AwsConfiguration vsConfigs, ConvertedConfiguration viConfigs, Warnings warnings); }
TransitGatewayPeeringConnector { @VisibleForTesting static boolean arePeers( TransitGatewayAttachment attachment1, TransitGatewayAttachment attachment2) { return attachment1.getResourceType() == ResourceType.PEERING && attachment2.getResourceType() == ResourceType.PEERING && attachment1.getId().equals(attachment2.getId()) && attachment1.getGatewayOwnerId().equals(attachment2.getResourceOwnerId()) && attachment1.getResourceOwnerId().equals(attachment2.getGatewayOwnerId()) && attachment1.getGatewayId().equals(attachment2.getResourceId()) && attachment1.getResourceId().equals(attachment2.getGatewayId()); }  static void connect(
      AwsConfiguration vsConfigs, ConvertedConfiguration viConfigs, Warnings warnings);  }