@Test public void getSubnets() { EndpointBuilder endpointBuilder = new EndpointBuilder(); HashSet<Subnet> emptyArray = utils.getSubnets(endpointBuilder.build().getTenant()); assertTrue(emptyArray.equals(Collections.emptySet())); List<Subnet> subnets = getSubnetList(); Tenant tenant = buildTenant().build(); endpointBuilder.setTenant(tenant.getId()); when(ctx.getTenant(any(TenantId.class))).thenReturn(new IndexedTenant(tenant)); HashSet<Subnet> result = utils.getSubnets(endpointBuilder.build().getTenant()); List<Subnet> resultAsList = new ArrayList<>(result); assertTrue(subnets.containsAll(resultAsList)); }
HashSet<Subnet> getSubnets(TenantId tenantId) { IndexedTenant indexedTenant = ctx.getTenant(tenantId); if (indexedTenant != null && indexedTenant.getTenant() != null) { ForwardingContext forwardingContext = indexedTenant.getTenant().getForwardingContext(); if (forwardingContext != null && forwardingContext.getSubnet() != null) { return new HashSet<>(forwardingContext.getSubnet()); } } return new HashSet<>(); }
DestinationMapperUtils { HashSet<Subnet> getSubnets(TenantId tenantId) { IndexedTenant indexedTenant = ctx.getTenant(tenantId); if (indexedTenant != null && indexedTenant.getTenant() != null) { ForwardingContext forwardingContext = indexedTenant.getTenant().getForwardingContext(); if (forwardingContext != null && forwardingContext.getSubnet() != null) { return new HashSet<>(forwardingContext.getSubnet()); } } return new HashSet<>(); } }
DestinationMapperUtils { HashSet<Subnet> getSubnets(TenantId tenantId) { IndexedTenant indexedTenant = ctx.getTenant(tenantId); if (indexedTenant != null && indexedTenant.getTenant() != null) { ForwardingContext forwardingContext = indexedTenant.getTenant().getForwardingContext(); if (forwardingContext != null && forwardingContext.getSubnet() != null) { return new HashSet<>(forwardingContext.getSubnet()); } } return new HashSet<>(); } DestinationMapperUtils(OfContext ctx); }
DestinationMapperUtils { HashSet<Subnet> getSubnets(TenantId tenantId) { IndexedTenant indexedTenant = ctx.getTenant(tenantId); if (indexedTenant != null && indexedTenant.getTenant() != null) { ForwardingContext forwardingContext = indexedTenant.getTenant().getForwardingContext(); if (forwardingContext != null && forwardingContext.getSubnet() != null) { return new HashSet<>(forwardingContext.getSubnet()); } } return new HashSet<>(); } DestinationMapperUtils(OfContext ctx);  }
DestinationMapperUtils { HashSet<Subnet> getSubnets(TenantId tenantId) { IndexedTenant indexedTenant = ctx.getTenant(tenantId); if (indexedTenant != null && indexedTenant.getTenant() != null) { ForwardingContext forwardingContext = indexedTenant.getTenant().getForwardingContext(); if (forwardingContext != null && forwardingContext.getSubnet() != null) { return new HashSet<>(forwardingContext.getSubnet()); } } return new HashSet<>(); } DestinationMapperUtils(OfContext ctx);   }