text
stringlengths
0
234
if Object.Is_Modified (7) then
Stmt.Save_Field (Name => COL_6_3_NAME, -- session_id
Value => Object.Session);
Object.Clear_Modified (7);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
Function Definition: procedure List (Object : in out Session_Vector;
Function Body: Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, SESSION_DEF'Access);
begin
Stmt.Execute;
Session_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Session_Ref;
Impl : constant Session_Access := new Session_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
Function Definition: procedure Dispatch_Event (T : in out Test;
Function Body: Kind : in Event_Index;
Expect_Count : in Natural;
Expect_Prio : in Natural) is
Factory : AWA.Applications.Factory.Application_Factory;
Conf : ASF.Applications.Config;
Ctx : aliased EL.Contexts.Default.Default_Context;
Path : constant String := Util.Tests.Get_Test_Path ("regtests/config/event-test.xml");
Action : aliased Action_Bean;
begin
Conf.Set ("database", Util.Tests.Get_Parameter ("database"));
declare
App : aliased AWA.Tests.Test_Application;
S : Util.Measures.Stamp;
Faces : aliased ASF.Servlets.Faces.Faces_Servlet;
SC : AWA.Services.Contexts.Service_Context;
begin
App.Initialize (Conf => Conf,
Factory => Factory);
App.Set_Global ("event_test",
Util.Beans.Objects.To_Object (Action'Unchecked_Access,
Util.Beans.Objects.STATIC));
SC.Set_Context (App'Unchecked_Access, null);
App.Add_Servlet (Name => "faces", Server => Faces'Unchecked_Access);
App.Register_Class ("AWA.Events.Tests.Event_Action",
Create_Action_Bean'Access);
AWA.Applications.Configs.Read_Configuration (App => App,
File => Path,
Context => Ctx'Unchecked_Access,
Override_Context => True);
Util.Measures.Report (S, "Initialize AWA application and read config");
App.Start;
Util.Measures.Report (S, "Start event tasks");
for I in 1 .. 100 loop
declare
Event : Module_Event;
begin
Event.Set_Event_Kind (Kind);
Event.Set_Parameter ("prio", "3");
Event.Set_Parameter ("template", "def");
App.Send_Event (Event);
Function Definition: function Create_From_Color is new Create_From_Enum (Color, "color_");
Function Body: procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Helpers.Selectors.Create_From_Query",
Test_Create_From_Query'Access);
Caller.Add_Test (Suite, "Test AWA.Helpers.Selectors.Create_From_Enum",
Test_Create_From_Enum'Access);
end Add_Tests;
-- ------------------------------
-- Test creation of selector from an SQL query
-- ------------------------------
procedure Test_Create_From_Query (T : in out Test) is
Session : constant ADO.Sessions.Session := AWA.Tests.Get_Application.Get_Session;
Query : constant String := "SELECT id, name from entity_type order by id";
Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query);
Result : ASF.Models.Selects.Select_Item_List;
Found_User : Boolean := False;