Added a test application around which to build unit tests.

This commit is contained in:
sb 2008-06-18 15:55:48 +00:00
parent 45df5ff5de
commit cc6533decf
5 changed files with 294 additions and 0 deletions

2
TestApp/Auto/1 Executable file
View file

@ -0,0 +1,2 @@

1
TestApp/Web/Controllers/Auto/1 Executable file
View file

@ -0,0 +1 @@

17
TestApp/Web/Views/Auto/test/1 Executable file
View file

@ -0,0 +1,17 @@
<!-- DOCTYPE application PUBLIC "-//CYGNETS//DTD ADL 0.1//EN" "http://www.cygnets.co.uk/schemas/adl-0.1.1.dtd" -->
<!-- DOCTYPE application SYSTEM "file:/C:/Projects/ADL/schemas/adl-0.dtd" -->
<!--
Application Description Language framework
testapp.adl.xml
the object of this file is to exercise as many aspects of ADL as possible;
it isn't expected to describe an application which does anything useful
Copyright (c) 2008 Cygnet Solutions Ltd
$Author: sb $
$Revision: 1.1 $
$Date: 2008-06-18 15:55:54 $
-->
<output xmlns="http://cygnets.co.uk/schemas/adl-1.2" xmlns:adl="http://cygnets.co.uk/schemas/adl-1.2" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<!--Layout is default-->

115
TestApp/testapp.adl.xml Executable file
View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- DOCTYPE application PUBLIC "-//CYGNETS//DTD ADL 0.1//EN" "http://www.cygnets.co.uk/schemas/adl-0.1.1.dtd" -->
<!-- DOCTYPE application SYSTEM "file:/C:/Projects/ADL/schemas/adl-0.dtd" -->
<!--
Application Description Language framework
testapp.adl.xml
the object of this file is to exercise as many aspects of ADL as possible;
it isn't expected to describe an application which does anything useful
Copyright (c) 2008 Cygnet Solutions Ltd
$Author: sb $
$Revision: 1.1 $
$Date: 2008-06-18 15:55:49 $
-->
<application name="adltestapp" xmlns="http://cygnets.co.uk/schemas/adl-1.2">
<content>
<head>
</head>
<top>
</top>
<foot>
</foot>
</content>
<typedef name="postcode" type="string" size="10"
pattern="^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$">
<documentation>
a postcode follows arcane rules; this specification from
http://regexlib.com/REDetails.aspx?regexp_id=260.
</documentation>
</typedef>
<typedef name="age" type="integer" minimum="0" maximum="120">
<documentation>
We don't believe people who claim to be over 120.
</documentation>
</typedef>
<group name="public"/>
<group name="admin" parent="public"/>
<entity name="person">
<property name="LastName" type="string" required="true" size="100" distinct="user">
<prompt locale="en-UK" prompt="Surname"/>
</property>
<property name="ForeNames" type="string" required="true" size="100" distinct="user">
<prompt locale="en-UK" prompt="Fore names"/>
</property>
<property name="Partner" type="entity" entity="person"/>
<property name="Gender" type="string" size="1" required="true">
<option value="M">
<prompt locale="en-GB" prompt="Male"/>
</option>
<option value="F">
<prompt locale="en-GB" prompt="Female"/>
</option>
</property>
<property name="age" type="defined" typedef="age"/>
<property name="Address" type="entity" entity="address" distinct="user"/>
<property name="Friends" type="link" entity="person"/>
<form name="edit" properties="listed">
<fieldgroup name="Personal Data">
<documentation>
Basic data about the person
</documentation>
<field property="ForeNames">
<prompt locale="en-GB" prompt="Fore names"/>
</field>
<field property="LastName">
<prompt locale="en-GB" prompt="Surname"/>
<help locale="en-GB">
Family name of this person, conventionally their last name
</help>
</field>
<field property="Partner"/>
<field property="Gender"/>
<field property="Address"/>
</fieldgroup>
<fieldgroup name="Community">
<field property="Friends"/>
</fieldgroup>
</form>
</entity>
<entity name="address">
<key>
<property name="Number" type="string" size="8" distinct="all">
<prompt locale="en-GB" prompt="House number"/>
<help locale="en-GB">
House or building number
</help>
</property>
<property name="Postcode" type="defined" typedef="postcode" required="false" distinct="all">
<prompt locale="en-UK" prompt="Post code"/>
</property>
</key>
<property name="Address1" type="string" required="true" size="255">
<prompt locale="en-UK" prompt="Address"/>
</property>
<property name="Address2" type="string" required="false" size="255">
<prompt locale="en-UK" prompt="Line 2"/>
</property>
<property name="Address3" type="string" required="false" size="255">
<prompt locale="en-UK" prompt="Line 3"/>
</property>
<property name="City" type="string" required="false" size="255">
<prompt locale="en-UK" prompt="Post town"/>
</property>
<property name="County" type="string" required="false" size="255" />
<form name="edit" properties="all"/>
<list name="list" properties="user-distinct"/>
</entity>
</application>

159
TestApp/testapp.auto.sql Executable file
View file

@ -0,0 +1,159 @@
-------------------------------------------------------------------------------------------------
--
-- Application Description Language Framework
--
-- Database for application adltestapp version
-- Generated for MS-SQL 2000+ using adl2mssql.xslt 1.2 $
--
-- Code generator (c) 2007 Cygnet Solutions Ltd
--
-------------------------------------------------------------------------------------------------
use ADL_TestApp;
-------------------------------------------------------------------------------------------------
-- authentication roles
-------------------------------------------------------------------------------------------------
execute sp_addrole @rolename = 'public'
GO
execute sp_addrole @rolename = 'admin'
GO
-------------------------------------------------------------------------------------------------
-- primary tables, views and permissions
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
-- primary table person
-------------------------------------------------------------------------------------------------
CREATE TABLE "person"
(
"person_Id" INT IDENTITY( 1, 1),
"LastName" VARCHAR( 100) NOT NULL,
"ForeNames" VARCHAR( 100) NOT NULL,
"Partner" INT,
"Gender" VARCHAR( 1) NOT NULL,
"age" INT ,
"Address" VARCHAR( 8)
,
PRIMARY KEY( "person_Id")
)
GO
---- permissions ------------------------------------------------------------------------------
REVOKE ALL ON "person" FROM public
GO
REVOKE ALL ON "person" FROM admin
GO
-------------------------------------------------------------------------------------------------
-- primary table address
-------------------------------------------------------------------------------------------------
CREATE TABLE "address"
(
"Number" VARCHAR( 8) ,
"Postcode" VARCHAR( 10) ,
"Address1" VARCHAR( 255) NOT NULL,
"Address2" VARCHAR( 255) ,
"Address3" VARCHAR( 255) ,
"City" VARCHAR( 255) ,
"County" VARCHAR( 255)
,
PRIMARY KEY( "Number", "Postcode")
)
GO
---- permissions ------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
-- link tables
-------------------------------------------------------------------------------------------------
-- Problems with responsibility for generating link tables:
-- @entity = person
-- $nearside = person
-- $farside = person_1
-- farlink = Friends
-- comparison = '0'
-- my responsibility = true
-------------------------------------------------------------------------------------------------
-- link table joining person with person
-------------------------------------------------------------------------------------------------
CREATE TABLE "LN_person_person"
(
"personLink" INT NOT NULL,
"person_1Link" INT NOT NULL
)
GO
---- permissions ------------------------------------------------------------------------------
REVOKE ALL ON LN_person_person FROM public
GO
REVOKE ALL ON LN_person_person FROM admin
GO
---- referential integrity --------------------------------------------------------------------
ALTER TABLE "LN_person_person"
ADD FOREIGN KEY ( "personLink")
REFERENCES "person" ON DELETE NO ACTION
GO
ALTER TABLE "LN_person_person"
ADD FOREIGN KEY ( "person_1Link")
REFERENCES "person" ON DELETE CASCADE
GO
-------------------------------------------------------------------------------------------------
-- primary referential integrity constraints
-------------------------------------------------------------------------------------------------
ALTER TABLE "person"
ADD FOREIGN KEY ( "Partner")
REFERENCES "person" ON DELETE NO ACTION
GO
ALTER TABLE "person"
ADD FOREIGN KEY ( "Address")
REFERENCES "address" ON DELETE NO ACTION
GO
-------------------------------------------------------------------------------------------------
-- end of file
-------------------------------------------------------------------------------------------------