@Test public void getSliEntityListShouldLookupSliEntities() throws Exception { setupCustomDataMocking(); List<Entity> expected = new ArrayList<Entity>(); Entity entity = new GenericEntity(SLI_TYPE3A, new HashMap<String, Object>()); List<Entity> queryResult = Arrays.asList(new Entity[] { entity }); when(mockSlcInterface.read(eq(SLI_TYPE3A), any(Query.class))).thenReturn(queryResult); expected.add(entity); entity = new GenericEntity(SLI_TYPE3B, new HashMap<String, Object>()); queryResult = Arrays.asList(new Entity[] { entity }); when(mockSlcInterface.read(eq(SLI_TYPE3B), any(Query.class))).thenReturn(queryResult); expected.add(entity); List<Entity> result = resolver.getSliEntityList(SIF_REF_ID3, ZONE_ID1); verify(mockSlcInterface, times(3)).read(Mockito.anyString(), any(Query.class)); verify(mockSlcInterface, times(1)).read(eq(SLI_TYPE3A), any(Query.class)); verify(mockSlcInterface, times(1)).read(eq(SLI_TYPE3B), any(Query.class)); Assert.assertEquals(expected.size(), result.size()); Assert.assertEquals(expected.get(0), result.get(0)); Assert.assertEquals(expected.get(1), result.get(1)); }
@Override public List<Entity> getSliEntityList(String sifId, String zoneId) { synchronized (lock) { String seaId = getZoneSea(zoneId); Map<String, List<SliEntityLocator>> idMap = customDataProvider.getIdMap(seaId); List<SliEntityLocator> locators = idMap.get(sifId); if (locators == null || locators.size() == 0) { LOG.error("No sif-sli mapping found for sifId: " + sifId); return new ArrayList<Entity>(); } List<Entity> entities = new ArrayList<Entity>(); for (SliEntityLocator locator : locators) { Entity entity = fetchSliEntity(locator); entities.add(entity); } return entities; } }
SifIdResolverCustomData implements SifIdResolver { @Override public List<Entity> getSliEntityList(String sifId, String zoneId) { synchronized (lock) { String seaId = getZoneSea(zoneId); Map<String, List<SliEntityLocator>> idMap = customDataProvider.getIdMap(seaId); List<SliEntityLocator> locators = idMap.get(sifId); if (locators == null || locators.size() == 0) { LOG.error("No sif-sli mapping found for sifId: " + sifId); return new ArrayList<Entity>(); } List<Entity> entities = new ArrayList<Entity>(); for (SliEntityLocator locator : locators) { Entity entity = fetchSliEntity(locator); entities.add(entity); } return entities; } } }
SifIdResolverCustomData implements SifIdResolver { @Override public List<Entity> getSliEntityList(String sifId, String zoneId) { synchronized (lock) { String seaId = getZoneSea(zoneId); Map<String, List<SliEntityLocator>> idMap = customDataProvider.getIdMap(seaId); List<SliEntityLocator> locators = idMap.get(sifId); if (locators == null || locators.size() == 0) { LOG.error("No sif-sli mapping found for sifId: " + sifId); return new ArrayList<Entity>(); } List<Entity> entities = new ArrayList<Entity>(); for (SliEntityLocator locator : locators) { Entity entity = fetchSliEntity(locator); entities.add(entity); } return entities; } }  }
SifIdResolverCustomData implements SifIdResolver { @Override public List<Entity> getSliEntityList(String sifId, String zoneId) { synchronized (lock) { String seaId = getZoneSea(zoneId); Map<String, List<SliEntityLocator>> idMap = customDataProvider.getIdMap(seaId); List<SliEntityLocator> locators = idMap.get(sifId); if (locators == null || locators.size() == 0) { LOG.error("No sif-sli mapping found for sifId: " + sifId); return new ArrayList<Entity>(); } List<Entity> entities = new ArrayList<Entity>(); for (SliEntityLocator locator : locators) { Entity entity = fetchSliEntity(locator); entities.add(entity); } return entities; } }  @Override String getSliGuid(String sifId, String zoneId); @Override List<String> getSliGuidList(String sifId, String zoneId); @Override String getSliGuidByType(String sifId, String sliType, String zoneId); @Override List<String> getSliGuidListByType(String sifId, String sliType, String zoneId); @Override Entity getSliEntityByType(String sifId, String sliType, String zoneId); @Override List<Entity> getSliEntityListByType(String sifId, String sliType, String zoneId); @Override Entity getSliEntity(String sifId, String zoneId); @Override List<Entity> getSliEntityList(String sifId, String zoneId); @Override String getZoneSea(String zoneId); @Override void putSliGuid(String sifId, String sliType, String sliId, String zoneId); @Override Entity getSliEntityFromOtherSifId(String sifId, String sliType, String zoneId); @Override void putSliGuidForOtherSifId(String sifId, String sliType, String sliId, String zoneId); }
SifIdResolverCustomData implements SifIdResolver { @Override public List<Entity> getSliEntityList(String sifId, String zoneId) { synchronized (lock) { String seaId = getZoneSea(zoneId); Map<String, List<SliEntityLocator>> idMap = customDataProvider.getIdMap(seaId); List<SliEntityLocator> locators = idMap.get(sifId); if (locators == null || locators.size() == 0) { LOG.error("No sif-sli mapping found for sifId: " + sifId); return new ArrayList<Entity>(); } List<Entity> entities = new ArrayList<Entity>(); for (SliEntityLocator locator : locators) { Entity entity = fetchSliEntity(locator); entities.add(entity); } return entities; } }  @Override String getSliGuid(String sifId, String zoneId); @Override List<String> getSliGuidList(String sifId, String zoneId); @Override String getSliGuidByType(String sifId, String sliType, String zoneId); @Override List<String> getSliGuidListByType(String sifId, String sliType, String zoneId); @Override Entity getSliEntityByType(String sifId, String sliType, String zoneId); @Override List<Entity> getSliEntityListByType(String sifId, String sliType, String zoneId); @Override Entity getSliEntity(String sifId, String zoneId); @Override List<Entity> getSliEntityList(String sifId, String zoneId); @Override String getZoneSea(String zoneId); @Override void putSliGuid(String sifId, String sliType, String sliId, String zoneId); @Override Entity getSliEntityFromOtherSifId(String sifId, String sliType, String zoneId); @Override void putSliGuidForOtherSifId(String sifId, String sliType, String sliId, String zoneId);  }