@SuppressWarnings("unchecked") @Test public void testGetStbsByKey() { MongoHouseService service = new MongoHouseService(); MongoOperations operations = EasyMock.createMock(MongoOperations.class); EasyMock.expect(operations.find((Query) EasyMock.anyObject(), (Class) EasyMock.anyObject(), (String) EasyMock.anyObject())).andReturn(null); EasyMock.replay(operations); ReflectionTestUtils.setField(service, "template", operations); String[] id = new String[1]; id[0] = "a"; Assert.assertNotNull(service.getStbsByKey(id), "Got Null"); }
@Override public Map<String,Object>[] getStbsByKey(String... keys) { Collection<String> keyList = new ArrayList<String>(); for (String key : keys) { keyList.add(key.toLowerCase().trim()); } Criteria criteria = new Criteria("keys").all(keyList); List<PersistableDevice> list = template.find(new Query(criteria), PersistableDevice.class, COLLECTION_NAME); return toArray(list); }
MongoHouseService extends AbstractDawgService implements HouseService { @Override public Map<String,Object>[] getStbsByKey(String... keys) { Collection<String> keyList = new ArrayList<String>(); for (String key : keys) { keyList.add(key.toLowerCase().trim()); } Criteria criteria = new Criteria("keys").all(keyList); List<PersistableDevice> list = template.find(new Query(criteria), PersistableDevice.class, COLLECTION_NAME); return toArray(list); } }
MongoHouseService extends AbstractDawgService implements HouseService { @Override public Map<String,Object>[] getStbsByKey(String... keys) { Collection<String> keyList = new ArrayList<String>(); for (String key : keys) { keyList.add(key.toLowerCase().trim()); } Criteria criteria = new Criteria("keys").all(keyList); List<PersistableDevice> list = template.find(new Query(criteria), PersistableDevice.class, COLLECTION_NAME); return toArray(list); }  }
MongoHouseService extends AbstractDawgService implements HouseService { @Override public Map<String,Object>[] getStbsByKey(String... keys) { Collection<String> keyList = new ArrayList<String>(); for (String key : keys) { keyList.add(key.toLowerCase().trim()); } Criteria criteria = new Criteria("keys").all(keyList); List<PersistableDevice> list = template.find(new Query(criteria), PersistableDevice.class, COLLECTION_NAME); return toArray(list); }  @Override void upsertStb(DawgDevice... stbs); void replace(DawgDevice... stbs); @Override Map<String,Object>[] getStbsById(String... id); @Override Map<String,Object>[] getStbsByKey(String... keys); @Override Map<String,Object>[] getStbsByQuery(String query); @Override void deleteStbById(String... id); @Override Map<String,Object> getById(String id); @Override Map<String,Object>[] getAll(); @Override Map<String, Object>[] getStbsByTag(String tag, String query); }
MongoHouseService extends AbstractDawgService implements HouseService { @Override public Map<String,Object>[] getStbsByKey(String... keys) { Collection<String> keyList = new ArrayList<String>(); for (String key : keys) { keyList.add(key.toLowerCase().trim()); } Criteria criteria = new Criteria("keys").all(keyList); List<PersistableDevice> list = template.find(new Query(criteria), PersistableDevice.class, COLLECTION_NAME); return toArray(list); }  @Override void upsertStb(DawgDevice... stbs); void replace(DawgDevice... stbs); @Override Map<String,Object>[] getStbsById(String... id); @Override Map<String,Object>[] getStbsByKey(String... keys); @Override Map<String,Object>[] getStbsByQuery(String query); @Override void deleteStbById(String... id); @Override Map<String,Object> getById(String id); @Override Map<String,Object>[] getAll(); @Override Map<String, Object>[] getStbsByTag(String tag, String query);  }