/** Test fetch all lights. */ @Test public void testFetchAllLights() { // Success situation - Process ID InquiryLightRequest request = TestBaseUtil.createInquiryLightRequest(TestBaseUtil.createUserContext()); request.setProcessId(1); InternalResultsResponse<Light> response = getSmartPointAccessorBCL().fetchAllLights(request); assertResultResponse(response); resetMocksToSmartPointArea(); // Error situation setSituation( getSmartPointAccessorBCL(), SituationsEnum.ERROR, ISmartPointDAC.class, FETCH_ALL_LIGHTS); response = getSmartPointAccessorBCL().fetchAllLights(request); assertMessages(response, ERROR_CODE); resetMocksToSmartPointArea(); // Success situation - Search setSituation( getSmartPointAccessorBCL(), SituationsEnum.SUCCESS, ISmartPointDAC.class, FETCH_ALL_LIGHTS); request = TestBaseUtil.createInquiryLightRequest(TestBaseUtil.createUserContext()); request.setProcessId(null); request.setSearch(TestBaseUtil.createCustomSearch()); response = getSmartPointAccessorBCL().fetchAllLights(request); assertResultResponse(response); // Error situation setSituation( getSmartPointAccessorBCL(), SituationsEnum.ERROR, ISmartPointDAC.class, FETCH_ALL_LIGHTS); response = getSmartPointAccessorBCL().fetchAllLights(request); assertMessages(response, ERROR_CODE); }
/** Test fetch all lights by custom search. */ @Test public void testFetchAllLightsByCustomSearch() { // Success situation CustomSearch customSearch = new CustomSearch(); customSearch.setName("name1"); customSearch.setDescription("description1"); SearchParameter param = new SearchParameter(); param.setPropertyEnum(PropertyEnum.GROUP_ID); param.setValue("5"); customSearch.getSearchParameters().add(param); CustomSearchRequest request = TestBaseUtil.createCustomSearchRequest(); request.setCustomSearch(customSearch); InternalResultsResponse<CustomSearch> response = getSmartPointUpdaterBCL().insertCustomSearch(request); assertResultResponse(response); InquiryLightRequest inquiryLightRequest = TestBaseUtil.createInquiryLightRequest(TestBaseUtil.createUserContext()); inquiryLightRequest.setSearch(response.getFirstResult()); InternalResultsResponse<Light> lightResponse = getSmartPointAccessorBCL().fetchAllLights(inquiryLightRequest); assertResultResponse(lightResponse); }
/** Test fetch smartpoints to map. */ @Test public void testFetchSmartpointsToMap() { // Success situation InquiryLightRequest request = TestBaseUtil.createInquiryLightRequest(TestBaseUtil.createUserContext()); request.setGeoCodeTrunc(1); InternalResultsResponse<GeocodeSmartpointInfo> response = getSmartPointAccessorBCL().fetchSmartpointsToMap(request); assertResultResponse(response); resetMocksToSmartPointArea(); // Error situation setSituation( getSmartPointAccessorBCL(), SituationsEnum.ERROR, ISmartPointDAC.class, "fetchSmartpointsToMap"); response = getSmartPointAccessorBCL().fetchSmartpointsToMap(request); assertMessages(response, ERROR_CODE); }
/** Test fetch light history. */ @Test public void testFetchLightHistory() { // Success situation InquiryLightRequest request = TestBaseUtil.createInquiryLightRequest(TestBaseUtil.createUserContext()); request.getLights().add(TestBaseUtil.createLight()); InternalResultsResponse<LightHistory> response = getSmartPointAccessorBCL().fetchLightHistory(request); assertResultResponse(response); resetMocksToSmartPointArea(); // Error situation setSituation( getSmartPointAccessorBCL(), SituationsEnum.ERROR, ISmartPointDAC.class, "fetchLightHistory"); response = getSmartPointAccessorBCL().fetchLightHistory(request); assertMessages(response, ERROR_CODE); }