1------------------------------------------------------------------------------ 2-- -- 3-- Matreshka Project -- 4-- -- 5-- Ada Modeling Framework -- 6-- -- 7-- Testsuite Component -- 8-- -- 9------------------------------------------------------------------------------ 10-- -- 11-- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> -- 12-- All rights reserved. -- 13-- -- 14-- Redistribution and use in source and binary forms, with or without -- 15-- modification, are permitted provided that the following conditions -- 16-- are met: -- 17-- -- 18-- * Redistributions of source code must retain the above copyright -- 19-- notice, this list of conditions and the following disclaimer. -- 20-- -- 21-- * Redistributions in binary form must reproduce the above copyright -- 22-- notice, this list of conditions and the following disclaimer in the -- 23-- documentation and/or other materials provided with the distribution. -- 24-- -- 25-- * Neither the name of the Vadim Godunko, IE nor the names of its -- 26-- contributors may be used to endorse or promote products derived from -- 27-- this software without specific prior written permission. -- 28-- -- 29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- 30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- 31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- 32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- 33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- 34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- 35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- 36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- 37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- 38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- 39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- 40-- -- 41------------------------------------------------------------------------------ 42-- $Revision: 3368 $ $Date: 2012-11-11 02:20:22 +0400 (Sun, 11 Nov 2012) $ 43------------------------------------------------------------------------------ 44-- Checks whether type of property is not null when it imported from UML2.3 45-- metamodel. 46------------------------------------------------------------------------------ 47with League.Application; 48 49with AMF.Facility; 50with AMF.UML.Properties; 51with AMF.UML.Types; 52with AMF.URI_Stores; 53with AMF.Visitors.UML_Visitors; 54with AMF.Visitors.UML_Containment; 55with XMI.Reader; 56 57with AMF.Internals.Modules.MOFEXT_Module; 58pragma Unreferenced (AMF.Internals.Modules.MOFEXT_Module); 59with AMF.Internals.Modules.UML_Module; 60pragma Unreferenced (AMF.Internals.Modules.UML_Module); 61 62procedure Test_227 is 63 64 type Test_227_Visitor is 65 limited new AMF.Visitors.UML_Visitors.UML_Visitor with 66 record 67 Found : Boolean := False; 68 end record; 69 70 overriding procedure Enter_Property 71 (Self : in out Test_227_Visitor; 72 Element : not null AMF.UML.Properties.UML_Property_Access; 73 Control : in out AMF.Visitors.Traverse_Control); 74 75 -------------------- 76 -- Enter_Property -- 77 -------------------- 78 79 overriding procedure Enter_Property 80 (Self : in out Test_227_Visitor; 81 Element : not null AMF.UML.Properties.UML_Property_Access; 82 Control : in out AMF.Visitors.Traverse_Control) 83 is 84 pragma Unreferenced (Control); 85 86 use type AMF.UML.Types.UML_Type_Access; 87 88 The_Type : constant AMF.UML.Types.UML_Type_Access := Element.Get_Type; 89 90 begin 91 Self.Found := True; 92 93 if The_Type = null then 94 raise Program_Error; 95 end if; 96 end Enter_Property; 97 98 Store : AMF.URI_Stores.URI_Store_Access; 99 Iterator : AMF.Visitors.UML_Containment.UML_Containment_Iterator; 100 Test : Test_227_Visitor; 101 102begin 103 AMF.Facility.Initialize; 104 Store := XMI.Reader.Read_URI (League.Application.Arguments.Element (1)); 105 Iterator.Visit (Test, Store); 106 107 if not Test.Found then 108 raise Program_Error; 109 end if; 110end Test_227; 111