@@ -373,79 +373,66 @@ SHOW EXTERNAL ACTIONS IN OdTest;
373373-- LEVEL 10: CREATE EXTERNAL ENTITIES (bulk from contract)
374374-- ############################################################################
375375--
376- -- These commands require a live OData client with cached $metadata
377- -- (fetched automatically during CREATE ODATA CLIENT). The service URL
378- -- must be reachable at creation time. All examples below are representative
379- -- of a real TripPin RW service integration; they are shown as comments
380- -- because services.odata.org is not reachable from CI.
376+ -- Bulk-creates external entities from the TripPin RW OData service.
377+ -- Validates mendixlabs/mxcli#143: key, attribute OData mapping, and
378+ -- capability annotations are all written correctly to BSON.
381379--
382- -- Syntax variants:
383- --
384- -- CREATE EXTERNAL ENTITIES FROM Module.Client;
385- -- CREATE EXTERNAL ENTITIES FROM Module.Client INTO OtherModule;
386- -- CREATE EXTERNAL ENTITIES FROM Module.Client ENTITIES (TypeA, TypeB);
387- -- CREATE OR MODIFY EXTERNAL ENTITIES FROM Module.Client;
388- -- CREATE OR MODIFY EXTERNAL ENTITIES FROM Module.Client INTO OtherModule ENTITIES (TypeA);
380+ -- Requires network access to services.odata.org (public, no auth).
381+ -- CREATE ODATA CLIENT fetches and caches $metadata automatically.
389382--
390383-- ############################################################################
391384
392- /*
393- * Test bulk import of external entities from TripPin OData service.
394- * Validates the feature added in mendixlabs/mxcli#143.
395- *
396- * CREATE MODULE TripPinClient;
397- *
398- * CREATE MODULE ROLE TripPinClient."User"
399- * DESCRIPTION 'Role for TripPin API access';
400- *
401- * CREATE CONSTANT TripPinClient."TripPinServiceUrl"
402- * TYPE String
403- * DEFAULT 'https://services.odata.org/TripPinRESTierService/';
404- *
405- * CREATE ODATA CLIENT TripPinClient."TripPinApiClient" (
406- * ODataVersion: OData4,
407- * MetadataUrl: 'https://services.odata.org/TripPinRESTierService/$metadata',
408- * Timeout: 300,
409- * ServiceUrl: @TripPinClient.TripPinServiceUrl,
410- * UseAuthentication: No
411- * );
412- *
413- * Level 10.1: Bulk import all entity types from the TripPin contract.
414- * Creates one Mendix external entity per OData entity type; top-level
415- * entity sets (Airlines, Airports, People) use the set name as the
416- * Mendix entity name. Derived/contained types (Flight, PlanItem,
417- * Trip, etc.) use the type name.
418- *
419- * CREATE EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient";
420- *
421- * Level 10.2: Import only specific entity types by name.
422- *
423- * CREATE EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient"
424- * ENTITIES (Airline, Airport);
425- *
426- * Level 10.3: Import all entities into a different module.
427- *
428- * CREATE EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient"
429- * INTO TripPinEntities;
430- *
431- * Level 10.4: Idempotent re-import - updates any existing entities.
432- *
433- * CREATE OR MODIFY EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient";
434- *
435- * Level 10.5: Combine INTO, ENTITIES filter, and OR MODIFY.
436- *
437- * CREATE OR MODIFY EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient"
438- * INTO TripPinEntities
439- * ENTITIES (Airline, Airport, Person);
385+ /**
386+ * Level 10.0: Set up the TripPin module, role, and constant.
440387 */
388+ CREATE MODULE TripPinClient;
389+ /
441390
442- -- ############################################################################
443- -- NOTE: CREATE ODATA CLIENT now auto-fetches and caches $metadata from the
444- -- MetadataUrl. CONTRACT BROWSING commands (SHOW CONTRACT ENTITIES/ACTIONS)
445- -- work on services with cached metadata. The test URLs above are not reachable
446- -- from CI, so contract browsing examples are not included here.
447- -- See cmd/mxcli/help_topics/odata.txt for syntax reference.
448- -- ############################################################################
391+ CREATE MODULE ROLE TripPinClient."User"
392+ DESCRIPTION 'Role for TripPin API access';
393+ /
394+
395+ CREATE CONSTANT TripPinClient."TripPinServiceUrl"
396+ TYPE String
397+ DEFAULT 'https://services.odata.org/TripPinRESTierService/';
398+ /
399+
400+ /**
401+ * Level 10.1: Register the TripPin RW service.
402+ * CREATE ODATA CLIENT fetches and caches $metadata from MetadataUrl.
403+ * ServiceUrl must reference a constant (CE6825).
404+ */
405+ CREATE ODATA CLIENT TripPinClient."TripPinApiClient" (
406+ ODataVersion: OData4,
407+ MetadataUrl: 'https://services.odata.org/TripPinRESTierService/$metadata',
408+ Timeout: 300,
409+ ServiceUrl: @TripPinClient.TripPinServiceUrl,
410+ UseAuthentication: No
411+ );
412+ /
413+
414+ /**
415+ * Level 10.2: Bulk import all entity types from the TripPin contract.
416+ * Creates one external entity per OData entity type. Top-level entity
417+ * sets (Airlines, Airports, People) use the set name; derived/contained
418+ * types (Flight, PlanItem, Trip, etc.) use the type name.
419+ */
420+ CREATE EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient";
421+ /
422+
423+ /**
424+ * Level 10.3: Import only specific entity types by name.
425+ */
426+ CREATE OR MODIFY EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient"
427+ ENTITIES (Airline, Airport);
428+ /
429+
430+ /**
431+ * Level 10.4: Import all entities into a different module.
432+ */
433+ CREATE OR MODIFY EXTERNAL ENTITIES FROM TripPinClient."TripPinApiClient"
434+ INTO TripPinClient;
435+ /
449436
450437-- ############################################################################
451438-- LEVEL 8.8: DROP (cleanup)
@@ -470,7 +457,13 @@ DROP ODATA CLIENT OdTest.SalesforceAPI;
470457/
471458
472459/**
473- * Level 8.8c: Drop an OData service
460+ * Level 8.8c: Drop the TripPin client (cascades to its external entities)
461+ */
462+ DROP ODATA CLIENT TripPinClient."TripPinApiClient";
463+ /
464+
465+ /**
466+ * Level 8.8d: Drop an OData service
474467 */
475468DROP ODATA SERVICE OdTest.CustomerAPI;
476469/
0 commit comments