test_class.declarator: TAG = ServicesManagerTest.class.getSimpleName()
test_class.modifier: public static final
test_class.original_string: public static final String TAG = ServicesManagerTest.class.getSimpleName();
test_class.type: String
test_class.var_name: TAG
test_class.declarator: mServicesManger = null
test_class.modifier: private
test_class.original_string: private ServicesManager mServicesManger = null;
test_class.type: ServicesManager
test_class.var_name: mServicesManger
test_class.file: model/src/test/java/com/zeuschan/littlefreshweather/model/restapi/ServicesManagerTest.java
test_class.identifier: ServicesManagerTest
test_case.body: @Test
      public void testServicesManagerGetCitys() throws Exception {
          assertNotNull(mServicesManger);
          TestSubscriber<List<CityEntity>> testSubscriber = TestSubscriber.create(new GetCitysDelegate());
          mServicesManger.getCityEntities().subscribe(testSubscriber);
          testSubscriber.awaitTerminalEvent();
          testSubscriber.assertNoErrors();
  
          /*final Logger logger = Logger.getLogger("testServicesManagerGetCitys");
          assertNotNull(mServicesManger);
          mServicesManger.getCitys()
                  .subscribe(new Subscriber<List<CityEntity>>() {
                      @Override
                      public void onCompleted() {
                          logger.info("onCompleted");
                      }
  
                      @Override
                      public void onError(Throwable e) {
                          logger.info("onError");
                      }
  
                      @Override
                      public void onNext(List<CityEntity> cityEntities) {
                          logger.info("onNext");
                          mCitys = cityEntities;
                          for (CityEntity city :
                                  cityEntities) {
                              logger.info(city.toString());
                          }
                      }
                  });
          assertNotNull(mCitys);
          assertFalse(mCitys.isEmpty());*/
      }
test_case.class_method_signature: ServicesManagerTest.testServicesManagerGetCitys()
test_case.full_signature: @Test public void testServicesManagerGetCitys()
test_case.identifier: testServicesManagerGetCitys
test_case.invocations: assertNotNull create subscribe getCityEntities awaitTerminalEvent assertNoErrors
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testServicesManagerGetCitys()
focal_class.declarator: TAG = ServicesManager.class.getSimpleName()
focal_class.modifier: private static final
focal_class.original_string: private static final String TAG = ServicesManager.class.getSimpleName();
focal_class.type: String
focal_class.var_name: TAG
focal_class.declarator: DEFAULT_TIMEOUT = 5
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_TIMEOUT = 5;
focal_class.type: int
focal_class.var_name: DEFAULT_TIMEOUT
focal_class.declarator: ourInstance = new ServicesManager()
focal_class.modifier: private static
focal_class.original_string: private static ServicesManager ourInstance = new ServicesManager();
focal_class.type: ServicesManager
focal_class.var_name: ourInstance
focal_class.declarator: weatherInfoService
focal_class.modifier: private final
focal_class.original_string: private final WeatherInfoService weatherInfoService;
focal_class.type: WeatherInfoService
focal_class.var_name: weatherInfoService
focal_class.declarator: mNameMap = new android.support.v4.util.ArrayMap<>(6)
focal_class.modifier: private
focal_class.original_string: private Map<String, String> mNameMap = new android.support.v4.util.ArrayMap<>(6);
focal_class.type: Map<String, String>
focal_class.var_name: mNameMap
focal_class.declarator: mCityEntities = new ArrayList<>()
focal_class.modifier: private
focal_class.original_string: private List<CityEntity> mCityEntities = new ArrayList<>();
focal_class.type: List<CityEntity>
focal_class.var_name: mCityEntities
focal_class.declarator: mWeatherCondtionEntities = new ArrayList<>()
focal_class.modifier: private
focal_class.original_string: private List<WeatherConditionEntity> mWeatherCondtionEntities = new ArrayList<>();
focal_class.type: List<WeatherConditionEntity>
focal_class.var_name: mWeatherCondtionEntities
focal_class.declarator: mForecasts = new ArrayList<>()
focal_class.modifier: private
focal_class.original_string: private List<WeatherEntity.Forecast> mForecasts = new ArrayList<>();
focal_class.type: List<WeatherEntity.Forecast>
focal_class.var_name: mForecasts
focal_class.file: model/src/main/java/com/zeuschan/littlefreshweather/model/restapi/ServicesManager.java
focal_class.identifier: ServicesManager
focal_class.interfaces: implements DataSource
focal_class.class_method_signature: ServicesManager.getInstance()
focal_class.full_signature: public static ServicesManager getInstance()
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: ServicesManager
focal_class.signature: ServicesManager getInstance()
focal_class.class_method_signature: ServicesManager.ServicesManager()
focal_class.full_signature: private  ServicesManager()
focal_class.identifier: ServicesManager
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  ServicesManager()
focal_class.class_method_signature: ServicesManager.clear()
focal_class.full_signature: @Override public void clear()
focal_class.identifier: clear
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clear()
focal_class.class_method_signature: ServicesManager.getCityEntities()
focal_class.full_signature: @Override public Observable<List<CityEntity>> getCityEntities()
focal_class.identifier: getCityEntities
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Observable<List<CityEntity>>
focal_class.signature: Observable<List<CityEntity>> getCityEntities()
focal_class.class_method_signature: ServicesManager.getWeatherConditionEntities()
focal_class.full_signature: @Override public Observable<List<WeatherConditionEntity>> getWeatherConditionEntities()
focal_class.identifier: getWeatherConditionEntities
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Observable<List<WeatherConditionEntity>>
focal_class.signature: Observable<List<WeatherConditionEntity>> getWeatherConditionEntities()
focal_class.class_method_signature: ServicesManager.getCityWeather(String cityId, boolean fromCache)
focal_class.full_signature: @Override public Observable<WeatherEntity> getCityWeather(String cityId, boolean fromCache)
focal_class.identifier: getCityWeather
focal_class.modifiers: @Override public
focal_class.parameters: (String cityId, boolean fromCache)
focal_class.return: Observable<WeatherEntity>
focal_class.signature: Observable<WeatherEntity> getCityWeather(String cityId, boolean fromCache)
focal_method.body: @Override
      public Observable<List<CityEntity>> getCityEntities() {
  
          return weatherInfoService.getCityInfos(Constants.CITY_LIST_URL)
                  .map(new Func1<String, List<CityEntity>>() {
                      @Override
                      public List<CityEntity> call(String citysResponse) {
                          /*
                          城市/地区编码	    英文	        中文	  国家代码	国家英文	    国家中文	省英文	省中文	所属上级市英文    所属上级市中文	纬度   	经度
                          CN101010100	    beijing	    北京	     CN	     China	     中国	beijing	北京	       beijing	          北京	39.904989	116.405285
                          CN101010200	    haidian	    海淀	     CN	     China	     中国	beijing	北京	       beijing	          北京	39.956074	116.310316
                          CN101010300	    chaoyang	朝阳	     CN	     China	     中国	beijing	北京	       beijing	          北京	39.921489	116.486409
                          */
  
                          if (TextUtils.isEmpty(citysResponse)) {
                              throw new WeatherServiceException("no data");
                          }
  
                          mCityEntities.clear();
                          BufferedReader reader = null;
                          try {
                              reader = new BufferedReader(new StringReader(citysResponse));
                              String tempString;
                              while ((tempString = reader.readLine()) != null) {
                                  if (tempString.startsWith(Constants.CITY_LIST_LINE_HEADER) || tempString.startsWith(Constants.CITY_LIST_LINE_HEADER_1)) {
                                      tempString = tempString.replace("|", "");
                                      tempString = tempString.trim();
                                      String [] cityFileds = tempString.split("\\s+");
                                      if (cityFileds.length >= Constants.CITY_LIST_FIELD_NUM) {
                                          CityEntity cityEntity = new CityEntity();
                                          cityEntity.setCityId(TextUtils.isEmpty(cityFileds[Constants.CITY_LIST_FIELD_ID]) ? CityEntity.DEFAULT_VALUE : cityFileds[Constants.CITY_LIST_FIELD_ID]);
                                          cityEntity.setCountry(TextUtils.isEmpty(cityFileds[Constants.CITY_LIST_FIELD_COUNTY]) ? CityEntity.DEFAULT_VALUE : cityFileds[Constants.CITY_LIST_FIELD_COUNTY]);
                                          cityEntity.setProvince(TextUtils.isEmpty(cityFileds[Constants.CITY_LIST_FIELD_PROVINCE]) ? CityEntity.DEFAULT_VALUE : cityFileds[Constants.CITY_LIST_FIELD_PROVINCE]);
                                          cityEntity.setCity(TextUtils.isEmpty(cityFileds[Constants.CITY_LIST_FIELD_CITY]) ? CityEntity.DEFAULT_VALUE : cityFileds[Constants.CITY_LIST_FIELD_CITY]);
                                          mCityEntities.add(cityEntity);
                                      }
                                  }
                              }
                          } catch (IOException e) {
                              e.printStackTrace();
                          } finally {
                              if (reader != null) {
                                  try {
                                      reader.close();
                                  } catch (IOException e) {
                                      e.printStackTrace();
                                  }
                              }
                          }
  
                          /*if (!citysResponse.getResultCode().equals(Constants.OK)) {
                              throw new WeatherServiceException("error code: " + citysResponse.getResultCode());
                          }
  
                          mCityEntities.clear();
                          List<CitysResponse.CityInfo> cityInfos = citysResponse.getCitys();
                          if (cityInfos != null) {
                              for (CitysResponse.CityInfo cityInfo : cityInfos) {
                                  if (cityInfo != null) {
                                      if (cityInfo.getId() != null && cityInfo.getId().length() > 7 && mNameMap.get(cityInfo.getId().subSequence(0, 7)) != null) {
                                          cityInfo.setProvince(mNameMap.get(cityInfo.getId().subSequence(0, 7)));
                                      }
                                      CityEntity cityEntity = new CityEntity();
                                      cityEntity.setCityId(TextUtils.isEmpty(cityInfo.getId()) ? CityEntity.DEFAULT_VALUE : cityInfo.getId());
                                      cityEntity.setCountry(TextUtils.isEmpty(cityInfo.getCountry()) ? CityEntity.DEFAULT_VALUE : cityInfo.getCountry());
                                      cityEntity.setProvince(TextUtils.isEmpty(cityInfo.getProvince()) ? CityEntity.DEFAULT_VALUE : cityInfo.getProvince());
                                      cityEntity.setCity(TextUtils.isEmpty(cityInfo.getCity()) ? CityEntity.DEFAULT_VALUE : cityInfo.getCity());
                                      mCityEntities.add(cityEntity);
                                  }
                              }
                          }*/
                          return mCityEntities;
                      }
                  });
      }
focal_method.class_method_signature: ServicesManager.getCityEntities()
focal_method.full_signature: @Override public Observable<List<CityEntity>> getCityEntities()
focal_method.identifier: getCityEntities
focal_method.invocations: map getCityInfos isEmpty clear readLine startsWith startsWith replace trim split setCityId isEmpty setCountry isEmpty setProvince isEmpty setCity isEmpty add printStackTrace close printStackTrace
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: Observable<List<CityEntity>>
focal_method.signature: Observable<List<CityEntity>> getCityEntities()