use of com.google.api.services.actions_fulfillment.v2.model.Location in project google-cloud-intellij by GoogleCloudPlatform.
the class GoogleApiClientAppEngineAdminServiceTest method testGetAllAppEngineLocations_success.
@Test
public void testGetAllAppEngineLocations_success() throws IOException, GoogleApiException {
String pageToken = "page-token";
ListLocationsResponse response1 = new ListLocationsResponse();
List<Location> locationsPage1 = Arrays.asList(createMockLocation("location-1"), createMockLocation("location-2"));
response1.setLocations(locationsPage1);
response1.setNextPageToken(pageToken);
List<Location> locationsPage2 = Arrays.asList(createMockLocation("location-3"), createMockLocation("location-4"));
ListLocationsResponse response2 = new ListLocationsResponse();
response2.setLocations(locationsPage2);
response2.setNextPageToken(null);
when(appengineClientMock.getAppsLocationsListQuery().setPageToken(any())).thenReturn(appengineClientMock.getAppsLocationsListQuery());
when(appengineClientMock.getAppsLocationsListQuery().execute()).thenReturn(response1);
Appengine.Apps.Locations.List appsLocationsListQuery2 = mock(Appengine.Apps.Locations.List.class);
when(appengineClientMock.getAppsLocationsListQuery().setPageToken(eq(pageToken))).thenReturn(appsLocationsListQuery2);
when(appsLocationsListQuery2.execute()).thenReturn(response2);
List<Location> expectedResults = new ArrayList<>(locationsPage1);
expectedResults.addAll(locationsPage2);
// make the call twice. the service should only be hit once per page
assertEquals(expectedResults, service.getAllAppEngineLocations(mock(Credential.class)));
assertEquals(expectedResults, service.getAllAppEngineLocations(mock(Credential.class)));
verify(appengineClientMock.getAppsLocationsListQuery(), times(1)).execute();
verify(appsLocationsListQuery2, times(1)).execute();
}
use of com.google.api.services.actions_fulfillment.v2.model.Location in project google-cloud-intellij by GoogleCloudPlatform.
the class GoogleApiClientAppEngineAdminServiceTest method createMockLocation.
private Location createMockLocation(String id) {
Location location = new Location();
location.setLocationId(id);
return location;
}
use of com.google.api.services.actions_fulfillment.v2.model.Location in project concord by walmartlabs.
the class TaskCallEventRecordingListener method event.
private static Map<String, Object> event(TaskCallEvent event) {
Map<String, Object> m = new HashMap<>();
Step currentStep = event.currentStep();
m.put("processDefinitionId", ProcessDefinitionUtils.getCurrentFlowName(event.processDefinition(), currentStep));
Location loc = currentStep != null ? currentStep.getLocation() : null;
if (loc != null) {
m.put("fileName", currentStep.getLocation().fileName());
m.put("line", currentStep.getLocation().lineNum());
m.put("column", currentStep.getLocation().column());
}
String taskName = event.taskName();
m.put("description", "Task: " + taskName);
m.put("name", taskName);
m.put("correlationId", event.correlationId());
if (event.error() != null) {
m.put("error", event.error());
}
return m;
}
use of com.google.api.services.actions_fulfillment.v2.model.Location in project concord by walmartlabs.
the class YamlDeserializersV2 method toException.
private static YamlProcessingException toException(Result.Failure<Atom, ?> f, JsonParser p, List<Atom> atoms) {
Location loc = null;
String got = "n/a";
int pos = f.getPosition();
if (pos >= 0) {
Atom a = atoms.get(f.getPosition());
loc = a.location;
got = a.name;
}
return new YamlProcessingException(loc, "Expected: " + f.getMessage() + ". Got '" + got + "'");
}
use of com.google.api.services.actions_fulfillment.v2.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationSearchQueryTest method searchForLocations_shouldReturnEmptyListByMismatchingUuidAndLastUpdated.
@Test
public void searchForLocations_shouldReturnEmptyListByMismatchingUuidAndLastUpdated() {
TokenAndListParam uuid = new TokenAndListParam().addAnd(new TokenParam(LOCATION_UUID));
DateRangeParam lastUpdated = new DateRangeParam().setUpperBound(DATE_RETIRED).setLowerBound(DATE_RETIRED);
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.COMMON_SEARCH_HANDLER, FhirConstants.ID_PROPERTY, uuid).addParameter(FhirConstants.COMMON_SEARCH_HANDLER, FhirConstants.LAST_UPDATED_PROPERTY, lastUpdated);
IBundleProvider results = search(theParams);
List<Location> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, empty());
}
Aggregations