@@ -65,18 +65,20 @@ private SampleApp() {}
6565 public static void main (String [] args ) throws Throwable {
6666 System .out .println (
6767 "\n \n \n === Choose example: ===\n "
68- + "0. Validate Configured Roles\n "
68+ + "0. Validate Configured ODRD Roles\n "
6969 + "1. Create Vehicle\n "
7070 + "2. Create Trip\n "
7171 + "3. List Vehicles\n "
7272 + "4. Search for Vehicles\n "
73- + "5. Search for Trips\n " );
73+ + "5. Search for Trips\n "
74+ + "----------------------------------------\n "
75+ + "10. Validate Configured LMFS Roles\n " );
7476 Scanner scanner = new Scanner (System .in , UTF_8 .name ());
7577 int choice = scanner .nextInt ();
7678
7779 switch (choice ) {
7880 case 0 :
79- ValidateRoles .run ();
81+ ValidateOdrdRoles .run ();
8082 break ;
8183 case 1 :
8284 createVehicle ();
@@ -93,7 +95,9 @@ public static void main(String[] args) throws Throwable {
9395 case 5 :
9496 searchTrips ();
9597 break ;
96- case 6 :
98+ case 10 :
99+ ValidateLmfsRoles .run ();
100+ break ;
97101 default :
98102 throw new IllegalArgumentException ("Invalid choice provided." );
99103 }
@@ -109,7 +113,7 @@ private static void createVehicle() throws SignerInitializationException, IOExce
109113 // Set the vehicle name to the specified format
110114 .setName (
111115 String .format (
112- "providers/%s/vehicles/%s" , Configuration .PROVIDER_ID , randomVehicleId ))
116+ "providers/%s/vehicles/%s" , OdrdConfiguration .PROVIDER_ID , randomVehicleId ))
113117
114118 // Set maximum capacity of vehicle to 1
115119 .setMaximumCapacity (1 )
@@ -137,14 +141,14 @@ private static void createVehicle() throws SignerInitializationException, IOExce
137141 .setVehicle (vehicle )
138142
139143 // Set the parent to the specified format
140- .setParent (String .format ("providers/%s" , Configuration .PROVIDER_ID ))
144+ .setParent (String .format ("providers/%s" , OdrdConfiguration .PROVIDER_ID ))
141145 .build ();
142146
143147 VehicleServiceSettings settings =
144148 new FleetEngineClientSettingsModifier <
145149 VehicleServiceSettings , VehicleServiceSettings .Builder >(createMinter ())
146150 .updateBuilder (VehicleServiceSettings .newBuilder ())
147- .setEndpoint (Configuration .FLEET_ENGINE_ADDRESS )
151+ .setEndpoint (OdrdConfiguration .FLEET_ENGINE_ADDRESS )
148152 .build ();
149153
150154 VehicleServiceClient client = VehicleServiceClient .create (settings );
@@ -158,7 +162,7 @@ private static void createTrip() throws SignerInitializationException, IOExcepti
158162 Trip .newBuilder ()
159163 // Set the trip name to the specified format
160164 .setName (
161- String .format ("providers/%s/trips/%s" , Configuration .PROVIDER_ID , randomTripId ))
165+ String .format ("providers/%s/trips/%s" , OdrdConfiguration .PROVIDER_ID , randomTripId ))
162166
163167 // Set the trip type to be exclusive as opposed to SHARED
164168 .setTripType (TripType .EXCLUSIVE )
@@ -180,14 +184,14 @@ private static void createTrip() throws SignerInitializationException, IOExcepti
180184 .setTrip (trip )
181185
182186 // Set the parent to the specified format
183- .setParent (String .format ("providers/%s" , Configuration .PROVIDER_ID ))
187+ .setParent (String .format ("providers/%s" , OdrdConfiguration .PROVIDER_ID ))
184188 .build ();
185189
186190 TripServiceSettings settings =
187191 new FleetEngineClientSettingsModifier <TripServiceSettings , TripServiceSettings .Builder >(
188192 createMinter ())
189193 .updateBuilder (TripServiceSettings .newBuilder ())
190- .setEndpoint (Configuration .FLEET_ENGINE_ADDRESS )
194+ .setEndpoint (OdrdConfiguration .FLEET_ENGINE_ADDRESS )
191195 .build ();
192196
193197 TripServiceClient client = TripServiceClient .create (settings );
@@ -199,14 +203,14 @@ private static void listVehicles() throws SignerInitializationException, IOExcep
199203 ListVehiclesRequest request =
200204 ListVehiclesRequest .newBuilder ()
201205 // Set the parent to the format providers/{providerId}
202- .setParent (String .format ("providers/%s" , Configuration .PROVIDER_ID ))
206+ .setParent (String .format ("providers/%s" , OdrdConfiguration .PROVIDER_ID ))
203207 .build ();
204208
205209 VehicleServiceSettings settings =
206210 new FleetEngineClientSettingsModifier <
207211 VehicleServiceSettings , VehicleServiceSettings .Builder >(createMinter ())
208212 .updateBuilder (VehicleServiceSettings .newBuilder ())
209- .setEndpoint (Configuration .FLEET_ENGINE_ADDRESS )
213+ .setEndpoint (OdrdConfiguration .FLEET_ENGINE_ADDRESS )
210214 .build ();
211215
212216 VehicleServiceClient client = VehicleServiceClient .create (settings );
@@ -224,7 +228,7 @@ private static void searchVehicles() throws SignerInitializationException, IOExc
224228 SearchVehiclesRequest request =
225229 SearchVehiclesRequest .newBuilder ()
226230 // Set the parent to the format providers/{providerId}
227- .setParent (String .format ("providers/%s" , Configuration .PROVIDER_ID ))
231+ .setParent (String .format ("providers/%s" , OdrdConfiguration .PROVIDER_ID ))
228232
229233 // Look for vehicles around a specific Lat \ Lng
230234 .setPickupPoint (TerminalLocation .newBuilder ().setPoint (EXAMPLE_LAT_LNG ).build ())
@@ -247,7 +251,7 @@ private static void searchVehicles() throws SignerInitializationException, IOExc
247251 new FleetEngineClientSettingsModifier <
248252 VehicleServiceSettings , VehicleServiceSettings .Builder >(createMinter ())
249253 .updateBuilder (VehicleServiceSettings .newBuilder ())
250- .setEndpoint (Configuration .FLEET_ENGINE_ADDRESS )
254+ .setEndpoint (OdrdConfiguration .FLEET_ENGINE_ADDRESS )
251255 .build ();
252256
253257 VehicleServiceClient client = VehicleServiceClient .create (settings );
@@ -265,7 +269,7 @@ private static void searchTrips() throws SignerInitializationException, IOExcept
265269 SearchTripsRequest request =
266270 SearchTripsRequest .newBuilder ()
267271 // Set the parent to the format providers/{providerId}
268- .setParent (String .format ("providers/%s" , Configuration .PROVIDER_ID ))
272+ .setParent (String .format ("providers/%s" , OdrdConfiguration .PROVIDER_ID ))
269273
270274 // Look for both active and inactive trips
271275 .setActiveTripsOnly (false )
@@ -275,7 +279,7 @@ private static void searchTrips() throws SignerInitializationException, IOExcept
275279 new FleetEngineClientSettingsModifier <TripServiceSettings , TripServiceSettings .Builder >(
276280 createMinter ())
277281 .updateBuilder (TripServiceSettings .newBuilder ())
278- .setEndpoint (Configuration .FLEET_ENGINE_ADDRESS )
282+ .setEndpoint (OdrdConfiguration .FLEET_ENGINE_ADDRESS )
279283 .build ();
280284
281285 TripServiceClient client = TripServiceClient .create (settings );
@@ -292,14 +296,14 @@ private static void searchTrips() throws SignerInitializationException, IOExcept
292296 private static FleetEngineTokenProvider createMinter () throws SignerInitializationException {
293297 return AuthTokenMinter .builder ()
294298 // Only the account for the server signer is needed in this example
295- .setServerSigner (ImpersonatedSigner .create (Configuration .SERVER_TOKEN_ACCOUNT ))
299+ .setServerSigner (ImpersonatedSigner .create (OdrdConfiguration .SERVER_TOKEN_ACCOUNT ))
296300
297301 // When the audience is not set, it defaults to https://fleetengine.googleapis.com/.
298302 // This is fine in the vast majority of cases.
299303 .setTokenFactory (
300304 new FleetEngineTokenFactory (
301305 FleetEngineTokenFactorySettings .builder ()
302- .setAudience (Configuration .FLEET_ENGINE_AUDIENCE )
306+ .setAudience (OdrdConfiguration .FLEET_ENGINE_AUDIENCE )
303307 .build ()))
304308
305309 // Build the minter
0 commit comments