You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(178) |
Feb
(169) |
Mar
(286) |
Apr
(117) |
May
(98) |
Jun
(68) |
Jul
(63) |
Aug
(121) |
Sep
(88) |
Oct
(124) |
Nov
(2) |
Dec
(111) |
2007 |
Jan
(224) |
Feb
(69) |
Mar
(10) |
Apr
(72) |
May
(7) |
Jun
(21) |
Jul
(33) |
Aug
(35) |
Sep
(12) |
Oct
(22) |
Nov
(5) |
Dec
(6) |
2008 |
Jan
(2) |
Feb
(10) |
Mar
(39) |
Apr
(58) |
May
(34) |
Jun
(9) |
Jul
(27) |
Aug
(10) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
From: Vance K. <va...@us...> - 2007-04-12 14:50:57
|
User: vancek Date: 07/04/12 07:50:59 plugins/samples/booking-seam/core/src/main/java/org/andromda - New directory |
From: Vance K. <va...@us...> - 2007-04-12 14:50:56
|
User: vancek Date: 07/04/12 07:50:58 plugins/samples/booking-seam/core/src/main/java/org - New directory |
From: Vance K. <va...@us...> - 2007-04-12 14:50:56
|
User: vancek Date: 07/04/12 07:50:58 plugins/samples/booking-seam/core/src/main/java - New directory |
From: Vance K. <va...@us...> - 2007-04-12 14:50:56
|
User: vancek Date: 07/04/12 07:50:58 plugins/samples/booking-seam/core/src/main - New directory |
From: Vance K. <va...@us...> - 2007-04-12 14:50:56
|
User: vancek Date: 07/04/12 07:50:57 plugins/samples/booking-seam/core/src - New directory |
From: Vance K. <va...@us...> - 2007-03-26 12:01:13
|
User: vancek Date: 07/03/26 05:01:06 Modified: andromda-ejb3/src/site changes.xml andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: fix support for abstract entity class declaration by modelliing entity as abstract (not mapped or having an implementation) Revision Changes Path 1.12 +8 -0 cartridges/andromda-ejb3/src/site/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/changes.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- changes.xml 18 Feb 2007 10:43:08 -0000 1.11 +++ changes.xml 26 Mar 2007 12:01:05 -0000 1.12 @@ -390,6 +390,14 @@ Set default topic subscription durability as NonDurable in case a Topic does not have the subscription durability TV modelled. </action> + <action dev="vancek" due-to="heapifyman" type="fix"> + Fix entity constructor generation when no attributes modelled but operation and associations exist. + </action> + <action dev="vancek" due-to="jonnyBgood" type="fix"> + Fix support for abstract super entity (add super to class declaration) even when super entity is not a + mapped superclass or specializes another entity. This also cleaned up the constructor implementation in + the inheriting entity. + </action> </release> </body> </document> \ No newline at end of file 1.46 +1 -4 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.45 retrieving revision 1.46 diff -u -w -r1.45 -r1.46 --- EntityEmbeddable.vsl 28 Feb 2007 00:56:18 -0000 1.45 +++ EntityEmbeddable.vsl 26 Mar 2007 12:01:06 -0000 1.46 @@ -119,7 +119,7 @@ #* *##end #**##end #end -public#if ($entity.entityImplementationRequired || $entity.embeddableSuperclass) abstract class ${entity.entityEmbeddableName}#else class ${entity.entityName}#end +public#if ($entity.entityImplementationRequired || $entity.embeddableSuperclass) abstract class ${entity.entityEmbeddableName}#else#if($entity.abstract) abstract#end class ${entity.entityName}#end #if($entity.requiresGeneralizationMapping) #**##if($entity.embeddableSuperclassGeneralizationExists) @@ -258,9 +258,6 @@ */ public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)) { -#**##if(!$inheritedAttributes.empty) - super($entity.getAttributesAsList($inheritedAttributes, false, true, false)); -#**##end #**##foreach ($attribute in $updatableAttributes) ${attribute.setterName}(${attribute.name}); #**##end |
From: Manish A. <mag...@us...> - 2007-03-06 10:45:06
|
User: magrawal Date: 07/03/06 02:44:55 Modified: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/Properties AssemblyInfo.cs Log: updated documentation and fixed FXCop issues. Revision Changes Path 1.3 +2 -2 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/Properties/AssemblyInfo.cs Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/Properties/AssemblyInfo.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- AssemblyInfo.cs 18 Jan 2007 12:19:40 -0000 1.2 +++ AssemblyInfo.cs 6 Mar 2007 10:44:54 -0000 1.3 @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] +[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyFileVersion("1.0.2.0")] |
From: Manish A. <mag...@us...> - 2007-03-06 10:44:33
|
User: magrawal Date: 07/03/06 02:44:32 Modified: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/Properties AssemblyInfo.cs Log: updated documentation and fixed FXCop issues. Revision Changes Path 1.3 +2 -2 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/Properties/AssemblyInfo.cs Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/Properties/AssemblyInfo.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- AssemblyInfo.cs 18 Jan 2007 12:19:27 -0000 1.2 +++ AssemblyInfo.cs 6 Mar 2007 10:44:32 -0000 1.3 @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] +[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyFileVersion("1.0.2.0")] |
From: Manish A. <mag...@us...> - 2007-03-06 10:43:20
|
User: magrawal Date: 07/03/06 02:43:20 Modified: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests TestScenarioHelperTests.cs etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit AndroMDA.ScenarioUnit.csproj CodeAsserterAttribute.cs CodeDataProviderAttribute.cs TestScenarioHelper.cs XMLAsserterAttribute.cs XMLDataProviderAttribute.cs Log: updated documentation and fixed FXCop issues. Revision Changes Path 1.4 +3 -3 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestScenarioHelperTests.cs Index: TestScenarioHelperTests.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestScenarioHelperTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- TestScenarioHelperTests.cs 18 Jan 2007 10:49:48 -0000 1.3 +++ TestScenarioHelperTests.cs 6 Mar 2007 10:43:19 -0000 1.4 @@ -26,14 +26,14 @@ TestScenarioHelper.Invoke("ProcessTestObject", "default", this); } [Test] - [ExpectedException(typeof(Exception), "Could not load data for testObj from the file ../../testdata/input\\TestScenarioHelperTests\\ProcessTestObject_NoInputFile_testObj.xml for the test method ProcessTestObject and scenario NoInputFile.")] + [ExpectedException(typeof(DataProviderException), "Could not load data for testObj from the file ../../testdata/input\\TestScenarioHelperTests\\ProcessTestObject_NoInputFile_testObj.xml for the test method ProcessTestObject and scenario NoInputFile.")] public void TestInvokeNoInputFile() { TestScenarioHelper.Invoke("ProcessTestObject", "NoInputFile", this); } [Test] - [ExpectedException(typeof(Exception), "Could not load the expected output from the file ../../testdata/expected_output\\TestScenarioHelperTests\\ProcessTestObject_NoExpectedOutputFile.xml for the test method ProcessTestObject and scenario NoExpectedOutputFile.")] + [ExpectedException(typeof(AsserterException), "Could not load the expected output from the file ../../testdata/expected_output\\TestScenarioHelperTests\\ProcessTestObject_NoExpectedOutputFile.xml for the test method ProcessTestObject and scenario NoExpectedOutputFile.")] public void TestInvokeNoExpectedOutputFile() { TestScenarioHelper.Invoke("ProcessTestObject", "NoExpectedOutputFile", this); @@ -405,7 +405,7 @@ #region test missing input or output files [Test] - [ExpectedException(typeof(Exception), "Could not write actual output to the file ../../testdata/actual_output\\InvalidPath\\ProcessInvalidOutputPath_InvalidActualOutputPath.xml for the test method ProcessInvalidOutputPath and scenario InvalidActualOutputPath.")] + [ExpectedException(typeof(AsserterException), "Could not write actual output to the file ../../testdata/actual_output\\InvalidPath\\ProcessInvalidOutputPath_InvalidActualOutputPath.xml for the test method ProcessInvalidOutputPath and scenario InvalidActualOutputPath.")] public void TestInvokeInvalidActualOutputPath() { TestScenarioHelper.Invoke("ProcessInvalidOutputPath", "InvalidActualOutputPath", this); 1.4 +4 -0 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.csproj Index: AndroMDA.ScenarioUnit.csproj =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- AndroMDA.ScenarioUnit.csproj 19 Feb 2007 06:54:19 -0000 1.3 +++ AndroMDA.ScenarioUnit.csproj 6 Mar 2007 10:43:19 -0000 1.4 @@ -20,6 +20,8 @@ <WarningLevel>4</WarningLevel> <PlatformTarget>AnyCPU</PlatformTarget> <DocumentationFile>bin\debug\AndroMDA.ScenarioUnit.XML</DocumentationFile> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRules>-Microsoft.Design#CA1062;-Microsoft.Globalization#CA1305</CodeAnalysisRules> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> @@ -48,8 +50,10 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="AsserterException.cs" /> <Compile Include="CodeDataProviderAttribute.cs" /> <Compile Include="CodeAsserterAttribute.cs" /> + <Compile Include="DataProviderException.cs" /> <Compile Include="XMLAsserterAttribute.cs" /> <Compile Include="IAsserter.cs" /> <Compile Include="IDataProvider.cs" /> 1.3 +2 -2 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeAsserterAttribute.cs Index: CodeAsserterAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeAsserterAttribute.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- CodeAsserterAttribute.cs 19 Feb 2007 06:54:19 -0000 1.2 +++ CodeAsserterAttribute.cs 6 Mar 2007 10:43:19 -0000 1.3 @@ -12,7 +12,7 @@ /// This asserter is similar to the traditional mechanism of using /// helper methods to separate out assertion logic from the main testing code. /// <para> - /// This asserter is helpful when used in conjunction with <see cref="XmlAsserter"/> for return values/output parameters + /// This asserter is helpful when used in conjunction with <see cref="XMLAsserterAttribute"/> for return values/output parameters /// that cannot be serialized into XML. /// </para> /// <para> @@ -35,7 +35,7 @@ /// </para> /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] - public class CodeAsserterAttribute + public sealed class CodeAsserterAttribute : Attribute, IAsserter { 1.4 +4 -4 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeDataProviderAttribute.cs Index: CodeDataProviderAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeDataProviderAttribute.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- CodeDataProviderAttribute.cs 19 Feb 2007 06:54:19 -0000 1.3 +++ CodeDataProviderAttribute.cs 6 Mar 2007 10:43:19 -0000 1.4 @@ -15,8 +15,8 @@ /// This method of loading test data is almost the same as the mechanism used in /// traditional unit testing where test data is separated out into helper methods. /// This data provider is useful when used in conjunction with the - /// <see cref="XMLDataProvider"/> for input data types that cannot be serialized into XML - /// and therefore cannot be loaded using <see cref="XMlDataProvider"/>. + /// <see cref="XMLDataProviderAttribute"/> for input data types that cannot be serialized into XML + /// and therefore cannot be loaded using <see cref="XMLDataProviderAttribute"/>. /// <para> /// This class derives from the <c>System.Attribute</c> class. This /// allows this class to be configured as a data provider for a test method parameter. @@ -36,7 +36,7 @@ /// </para> /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] - public class CodeDataProviderAttribute + public sealed class CodeDataProviderAttribute : Attribute, IDataProvider { @@ -115,7 +115,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not load data for {0} from the method {1} for the test method {2} and scenario {3}.", pInfo.Name, DataMethodName, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new DataProviderException(errorMessage, e); } } } 1.3 +5 -4 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/TestScenarioHelper.cs Index: TestScenarioHelper.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/TestScenarioHelper.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- TestScenarioHelper.cs 19 Feb 2007 06:54:19 -0000 1.2 +++ TestScenarioHelper.cs 6 Mar 2007 10:43:19 -0000 1.3 @@ -5,9 +5,7 @@ using System.Reflection; -///<summary> -///This namespace contains the various classes for the AndroMDA.ScenarioUnit library. -///</summary> + namespace AndroMDA.ScenarioUnit { /// <summary> @@ -49,7 +47,10 @@ /// </remarks> public class TestScenarioHelper { - + /// <summary> + /// Making the constructor protected so that this class is + /// not instantiated. + /// </summary> protected TestScenarioHelper() { } /// <summary> 1.5 +7 -7 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLAsserterAttribute.cs Index: XMLAsserterAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLAsserterAttribute.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- XMLAsserterAttribute.cs 19 Feb 2007 06:54:19 -0000 1.4 +++ XMLAsserterAttribute.cs 6 Mar 2007 10:43:19 -0000 1.5 @@ -21,7 +21,7 @@ /// Internally, it uses an open source XML-based unit testing framework called /// NXUnit <see ref="http://www.sf.net/NXUnit"/> to perform the XML comparisons. /// <para> - /// Similar to the <see cref="XMLDataProvider"/>, this asserter also uses the + /// Similar to the <see cref="XMLDataProviderAttribute"/>, this asserter also uses the /// XML format produced by serializing an object using the System.Xml.Serialization.XmlSerializer class. /// This means that this asserter can be used to assert only those return/output types /// that can be serialized into XML. @@ -79,7 +79,7 @@ /// </para> /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] - public class XMLAsserterAttribute + public sealed class XMLAsserterAttribute : Attribute, IAsserter { #region properties @@ -226,7 +226,7 @@ /// </para> /// <para> /// The name of the physical file is created using the same naming convention as that used - /// by the <see cref="XMLDataProvider"/> class: methodName_scenarioName_parameterName.xml. + /// by the <see cref="XMLDataProviderAttribute"/> class: methodName_scenarioName_parameterName.xml. /// <note> /// In case of return parameters, there is no "parameterName", so, the file name is just methodName_scenarioName.xml. /// </note> @@ -317,7 +317,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not write actual output to the file {0} for the test method {1} and scenario {2}.", actualOutputPath, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new AsserterException(errorMessage, e); } } @@ -348,7 +348,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not load the assertion rules from the file {0} for the test method {1} and scenario {2}.", rulesPath, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new AsserterException(errorMessage, e); } XmlDocument actualXml = new XmlDocument(); @@ -360,7 +360,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not load the actual output from the file {0} for the test method {1} and scenario {2}.", actualOutputPath, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new AsserterException(errorMessage, e); } XmlDocument expectedXml = new XmlDocument(); @@ -372,7 +372,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not load the expected output from the file {0} for the test method {1} and scenario {2}.", expectedOutputPath, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new AsserterException(errorMessage, e); } XMLInput actual = XMLInput.CreateInput(actualXml); 1.4 +3 -3 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLDataProviderAttribute.cs Index: XMLDataProviderAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLDataProviderAttribute.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- XMLDataProviderAttribute.cs 19 Feb 2007 06:54:19 -0000 1.3 +++ XMLDataProviderAttribute.cs 6 Mar 2007 10:43:19 -0000 1.4 @@ -47,7 +47,7 @@ /// </para> /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] - public class XMLDataProviderAttribute + public sealed class XMLDataProviderAttribute : Attribute, IDataProvider { #region member variables and properties. @@ -57,7 +57,7 @@ /// This property is used in conjunction with the /// configuration entry /// <code escaped="true"> - /// <add key="TestDataInputDir" value="[some path]"> + /// <add key="TestDataInputDir" value="[some path]"/> /// </code> /// This configuration entry specifies the directory that contains all input data XML files. /// This property is used to specify a sub-directory below the TestDataInputDir @@ -182,7 +182,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not load data for {0} from the file {1} for the test method {2} and scenario {3}.", pInfo.Name, inputPath, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new DataProviderException(errorMessage, e); } } |
From: Manish A. <mag...@us...> - 2007-03-06 10:41:36
|
User: magrawal Date: 07/03/06 02:41:36 Added: etc/andromda-dotnet/AndroMDA.ScenarioUnit introduction to Andromda.scenariounit.doc Log: added tutorial Revision Changes Path No revision No revision No revision |
From: Manish A. <mag...@us...> - 2007-03-06 10:40:16
|
User: magrawal Date: 07/03/06 02:40:16 Added: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit DataProviderException.cs Log: added data provider exception. Revision Changes Path 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/DataProviderException.cs Index: DataProviderException.cs =================================================================== using System; namespace AndroMDA.ScenarioUnit { public class DataProviderException : Exception { public DataProviderException(string message, Exception e) : base(message, e) { } } } |
From: Manish A. <mag...@us...> - 2007-03-06 10:39:07
|
User: magrawal Date: 07/03/06 02:39:07 Added: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit AsserterException.cs Log: added asserter exception. Revision Changes Path 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/AsserterException.cs Index: AsserterException.cs =================================================================== using System; namespace AndroMDA.ScenarioUnit { public class AsserterException : Exception { public AsserterException(string message, Exception e) : base(message, e) { } } } |
From: Manish A. <mag...@us...> - 2007-03-06 10:37:00
|
User: magrawal Date: 07/03/06 02:36:59 Added: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests NullReturn_NullReturnParameter.xml Log: added missing expected output file. Revision Changes Path 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/NullReturn_NullReturnParameter.xml Index: NullReturn_NullReturnParameter.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <anyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:nil="true" /> |
From: Walter M. <wal...@us...> - 2007-03-04 19:08:42
|
User: walterim Date: 07/03/04 11:08:39 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout header.xhtml.vsl layout.xhtml.vsl andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud view.xhtml.vsl andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades JSFManageableEntityLogicImpl.java JSFViewLogicImpl.java andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/views/facelets view.xhtml.vsl andromda-jsf2/src/main/uml JSFMetafacadeModel.xml.zip Removed: andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout menu.xhtml.vsl andromda-jsf2/src/main/resources/resources/lib/facelets jsf-facelets.jar el-ri.jar el-api.jar andromda-jsf2/src/main/resources/resources/lib/adf trinidad-impl-incubator-m1-SNAPSHOT.jar trinidad-api-incubator-m1-SNAPSHOT.jar Log: File upload support Revision Changes Path 1.2 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/header.xhtml.vsl Index: header.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/header.xhtml.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- header.xhtml.vsl 5 Dec 2006 19:39:25 -0000 1.1 +++ header.xhtml.vsl 4 Mar 2007 19:08:30 -0000 1.2 @@ -3,7 +3,7 @@ xmlns:tr="http://myfaces.apache.org/trinidad" xmlns:h="http://java.sun.com/jsf/html"> <ui:composition> - <tr:panelGroupLayout layout="vertical" inlineStyle="overflow: auto; font-size: xx-large; font-weight: bold;"> + <tr:panelGroupLayout inlineStyle="overflow: auto; font-size: x-large; font-weight: bold;"> <h:outputText>#{messages['application.name']}</h:outputText> </tr:panelGroupLayout> </ui:composition> 1.6 +16 -13 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/layout.xhtml.vsl Index: layout.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/layout.xhtml.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- layout.xhtml.vsl 23 Feb 2007 21:19:38 -0000 1.5 +++ layout.xhtml.vsl 4 Mar 2007 19:08:30 -0000 1.6 @@ -13,7 +13,8 @@ </ui:insert> <c:set var="remoteUser" value="${facesContext.externalContext.request.userPrincipal.name}" scope="request"/> <trh:body> - <tr:form> + <ui:insert name="usesUpload"/> + <tr:form usesUpload="#{usesUpload}"> <ui:insert name="title"/> <tr:panelPage> <f:facet name="branding"> @@ -74,23 +75,25 @@ #end </tr:navigationPane> </f:facet> - <f:facet name="location"> - <tr:breadCrumbs var="item" value="#{menuModel.model}"> - <f:facet name="nodeStamp"> - <tr:commandNavigationItem text="#{messages[item.label]}" action="#{item.getAction}"/> - </f:facet> - </tr:breadCrumbs> - </f:facet> +##using breadcrumbs ? +## <f:facet name="location"> +## <tr:breadCrumbs var="item" value="#{menuModel.model}"> +## <f:facet name="nodeStamp"> +## <tr:commandNavigationItem text="#{messages[item.label]}" action="#{item.getAction}"/> +## </f:facet> +## </tr:breadCrumbs> +## </f:facet> <f:facet name="appCopyright"> <ui:insert name="footer"> <ui:include src="footer.xhtml"/> </ui:insert> </f:facet> - <f:facet name="infoReturn"> - <ui:insert name="return"> - <ui:include src="return.xhtml"/> - </ui:insert> - </f:facet> +## using return ? don't forget to remove de return.xhtml +## <f:facet name="infoReturn"> +## <ui:insert name="return"> +## <ui:include src="return.xhtml"/> +## </ui:insert> +## </f:facet> <div id="pageContent"> <tr:panelHeader text="#{title}"> <ui:insert name="content"/> 1.6 +4 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud/view.xhtml.vsl Index: view.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud/view.xhtml.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- view.xhtml.vsl 20 Feb 2007 10:16:37 -0000 1.5 +++ view.xhtml.vsl 4 Mar 2007 19:08:31 -0000 1.6 @@ -82,6 +82,9 @@ #set ($layout = "/layout/layout.xhtml") <ui:composition template="$layout"> + <ui:define name="usesUpload"> + <c:set var="usesUpload" value="${manageable.needsFileUpload}" scope="request"/> + </ui:define> <ui:define name="title"> <c:set var="title" value="#{messages['${manageable.viewTitleKey}']}" scope="request"/> </ui:define> @@ -140,7 +143,7 @@ </h:panelGroup> </tr:column> #foreach ($member in $manageable.manageableAttributes) -#if(!$member.hidden) +#if(!$member.hidden && !$member.inputFile) <tr:column sortable=#if($manageable.tableSortable)"true"#else"false"#end sortProperty="$member.name"> <f:facet name="header"> <h:outputText value="#{messages['$member.messageKey']}"/> 1.4 +15 -0 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityLogicImpl.java Index: JSFManageableEntityLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityLogicImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- JSFManageableEntityLogicImpl.java 21 Feb 2007 19:41:27 -0000 1.3 +++ JSFManageableEntityLogicImpl.java 4 Mar 2007 19:08:31 -0000 1.4 @@ -584,4 +584,19 @@ } return rolesBuffer.toString(); } + + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#isNeedsFileUpload() + */ + protected boolean handleIsNeedsFileUpload() + { + for (final Iterator iterator = this.getManageableAttributes().iterator(); iterator.hasNext();) + { + final JSFManageableEntityAttribute attribute = (JSFManageableEntityAttribute)iterator.next(); + if(attribute.isNeedsFileUpload()) + return true; + } + return false; + } + } \ No newline at end of file 1.2 +22 -0 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFViewLogicImpl.java Index: JSFViewLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFViewLogicImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- JSFViewLogicImpl.java 5 Dec 2006 19:39:09 -0000 1.1 +++ JSFViewLogicImpl.java 4 Mar 2007 19:08:31 -0000 1.2 @@ -375,4 +375,26 @@ { return JSFUtils.toWebResourceName(this.getUseCase().getName() + "-" + this.getName()); } + + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFView#isNeedsFileUpload() + */ + protected boolean handleIsNeedsFileUpload() + { + for (final Iterator iterator = this.getAllActionParameters().iterator(); iterator.hasNext();) + { + final Object object = iterator.next(); + if (object instanceof JSFParameter){ + final JSFParameter parameter = (JSFParameter)object; + if(parameter.isInputFile()) + return true; + if(parameter.isComplex()){ + for(final Iterator attributes = parameter.getAttributes().iterator(); iterator.hasNext();) + if(((JSFAttribute)attributes.next()).isInputFile()) + return true; + } + } + } + return false; + } } 1.6 +2 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/Controller.java.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- Controller.java.vsl 4 Mar 2007 16:06:54 -0000 1.5 +++ Controller.java.vsl 4 Mar 2007 19:08:34 -0000 1.6 @@ -251,7 +251,7 @@ #set ($comma = '') #foreach ($member in $manageable.manageableMembers) #if ($member.inputFile) - ${comma}org.apache.commons.io.IOUtils.toByteArray(form.${member.getterName}().getInputStream()) + ${comma}form.${member.getterName}()==null?null:org.apache.commons.io.IOUtils.toByteArray(form.${member.getterName}().getInputStream()) #else ${comma}form.${member.getterName}() #end @@ -264,7 +264,7 @@ #set ($comma = '') #foreach ($member in $manageable.manageableMembers) #if ($member.inputFile) - ${comma}org.apache.commons.io.IOUtils.toByteArray(form.${member.getterName}().getInputStream()) + ${comma}form.${member.getterName}()==null?null:org.apache.commons.io.IOUtils.toByteArray(form.${member.getterName}().getInputStream()) #else ${comma}form.${member.getterName}() #end 1.2 +3 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/view.xhtml.vsl Index: view.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/view.xhtml.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- view.xhtml.vsl 5 Dec 2006 19:39:14 -0000 1.1 +++ view.xhtml.vsl 4 Mar 2007 19:08:34 -0000 1.2 @@ -10,6 +10,9 @@ #set ($layout = "/layout/layout.xhtml") #end <ui:composition template="$layout"> + <ui:define name="usesUpload"> + <c:set var="usesUpload" value="${view.needsFileUpload}" scope="request"/> + </ui:define> <ui:define name="title"> <c:set var="title" value="#{messages['${view.titleKey}']}" scope="request"/> </ui:define> 1.5 +202 -194 cartridges/andromda-jsf2/src/main/uml/JSFMetafacadeModel.xml.zip <<Binary file>> |
From: Walter M. <wal...@us...> - 2007-03-04 16:06:54
|
User: walterim Date: 07/03/04 08:06:54 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views renderActionFormInput.vm andromda-jsf2/src/main/resources/templates/jsf2/forms/crud Form.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl Log: File upload support Revision Changes Path 1.5 +3 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/renderActionFormInput.vm Index: renderActionFormInput.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/renderActionFormInput.vm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- renderActionFormInput.vm 18 Jan 2007 12:37:13 -0000 1.4 +++ renderActionFormInput.vm 4 Mar 2007 16:06:54 -0000 1.5 @@ -67,7 +67,9 @@ </tr:panelLabelAndMessage> #else ##if the widget type is not defined explicit ... -#if($parameter.type.enumeration) +#if($parameter.inputFile) + <tr:inputFile id="$propertyId" value="#{${formValuePropertyName}}" label="#{messages['$parameter.messageKey']}:" required="$parameter.required" columns="50"/> +#elseif($parameter.type.enumeration) #set ($multiSelect = $parameter.type.collectionType || $parameter.type.arrayType) #set ($selectBoxType = "selectOneChoice") #if ($multiSelect) 1.3 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/crud/Form.java.vsl Index: Form.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/crud/Form.java.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- Form.java.vsl 18 Jan 2007 10:11:08 -0000 1.2 +++ Form.java.vsl 4 Mar 2007 16:06:54 -0000 1.3 @@ -94,7 +94,7 @@ #foreach ($field in $manageable.manageableAttributes) #if ($field.type.collectionType) #set ($fieldTypeName = "java.util.List") -#elseif ($field.type.fileType) +#elseif ($field.inputFile) #set ($fieldTypeName = "$fileTypeName") #else #set ($fieldTypeName = $field.type.fullyQualifiedName) 1.5 +8 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/Controller.java.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- Controller.java.vsl 20 Feb 2007 10:14:55 -0000 1.4 +++ Controller.java.vsl 4 Mar 2007 16:06:54 -0000 1.5 @@ -250,7 +250,11 @@ ${manageable.manageableServiceAccessorCall}.create( #set ($comma = '') #foreach ($member in $manageable.manageableMembers) +#if ($member.inputFile) + ${comma}org.apache.commons.io.IOUtils.toByteArray(form.${member.getterName}().getInputStream()) +#else ${comma}form.${member.getterName}() +#end #set ($comma = ', ') #end ); @@ -259,7 +263,11 @@ ${manageable.manageableServiceAccessorCall}.update( #set ($comma = '') #foreach ($member in $manageable.manageableMembers) +#if ($member.inputFile) + ${comma}org.apache.commons.io.IOUtils.toByteArray(form.${member.getterName}().getInputStream()) +#else ${comma}form.${member.getterName}() +#end #set ($comma = ', ') #end ); |
From: Vance K. <va...@us...> - 2007-02-28 01:40:06
|
User: vancek Date: 07/02/27 17:40:01 Modified: andromda-ejb3 pom.xml Log: skip tests temporarily - prior to seam cartridge commit Revision Changes Path 1.16 +1 -0 cartridges/andromda-ejb3/pom.xml Index: pom.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/pom.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- pom.xml 7 Feb 2007 04:28:44 -0000 1.15 +++ pom.xml 28 Feb 2007 01:40:01 -0000 1.16 @@ -282,6 +282,7 @@ </plugins> </reporting> <properties> + <maven.test.skip>true</maven.test.skip> <model.uri>jar:file:${pom.basedir}/src/main/uml/EJB3MetafacadeModel.xml.zip!/EJB3MetafacadeModel.xml</model.uri> <test.model.uri>jar:file:${pom.basedir}/src/test/uml/EJB3CartridgeTestModel.xml.zip!/EJB3CartridgeTestModel.xml</test.model.uri> </properties> |
From: Vance K. <va...@us...> - 2007-02-28 00:56:18
|
User: vancek Date: 07/02/27 16:56:18 Modified: andromda-ejb3/src/main/resources/templates/ejb3 Entity.vsl EntityEmbeddable.vsl Log: fix for constructor generation when no attributes modelled and operations exist Revision Changes Path 1.21 +5 -4 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/Entity.vsl Index: Entity.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/Entity.vsl,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -r1.20 -r1.21 --- Entity.vsl 1 Jul 2006 10:13:01 -0000 1.20 +++ Entity.vsl 28 Feb 2007 00:56:18 -0000 1.21 @@ -104,19 +104,20 @@ #set ($relations = $entity.allEntityRelations) #if (!$relations.empty) #**##if ($entity.syntheticCreateMethodAllowed) +#* *##set ($updatableAttributes = $transform.filterUpdatableAttributes($allAttributes, $entity.compositePrimaryKeyPresent)) /** * Constructor with all POJO attribute values and CMR relations. * -#* *##foreach($attribute in $transform.filterUpdatableAttributes($allAttributes, $entity.compositePrimaryKeyPresent)) +#* *##foreach($attribute in $updatableAttributes) * @param $attribute.name Value for the ${attribute.name} property #* *##end #* *##foreach ($relation in $relations) - * @param $relation.otherEnd.name Value for the ${relation.otherEnd.name} relation role + * @param $relation.otherEnd.name Value for the ${relation.otherEnd.name} relation #* *##end */ - public ${entity.entityName}($entity.getAttributesAsList($allAttributes, true, true, false)#if(!$allAttributes.empty), #end#foreach ($relation in $relations)${relation.otherEnd.getterSetterTypeName} $relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end) + public ${entity.entityName}($entity.getAttributesAsList($allAttributes, true, true, false)#if(!$updatableAttributes.empty), #end#foreach ($relation in $relations)${relation.otherEnd.getterSetterTypeName} $relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end) { - super($entity.getAttributesAsList($allAttributes, false, true, false)#if(!$allAttributes.empty), #end#foreach ($relation in $relations)$relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end); + super($entity.getAttributesAsList($updatableAttributes, false, true, false)#if(!$updatableAttributes.empty), #end#foreach ($relation in $relations)$relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end); } #**##end 1.45 +11 -8 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.44 retrieving revision 1.45 diff -u -w -r1.44 -r1.45 --- EntityEmbeddable.vsl 17 Feb 2007 14:09:08 -0000 1.44 +++ EntityEmbeddable.vsl 28 Feb 2007 00:56:18 -0000 1.45 @@ -43,9 +43,15 @@ #else @javax.persistence.Entity #**##if ($entity.seamComponent) -...@or...("${entity.seamComponentName}") +/** + * Use components.xml to define Seam components + * @org.jboss.seam.annotations.Name("${entity.seamComponentName}") + */ #* *##if ($stringUtils.isNotBlank($entity.seamComponentScopeType)) -...@or...ope(org.jboss.seam.ScopeType.${entity.seamComponentScopeType}) +/** + * Use components.xml to define Seam component scope type + * @org.jboss.seam.annotations.Scope(org.jboss.seam.ScopeType.${entity.seamComponentScopeType}) + */ #* *##end #**##end ## @@ -234,10 +240,7 @@ /** * Default empty constructor */ - public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end() - { - // default null constructor - } + public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end() {} ## Autogenerate a constructor implementation with all attributes. #set ($allAttributes = $transform.filterByVisibility($entity.allInstanceAttributes, "public")) @@ -267,15 +270,15 @@ #set ($relations = $entity.allEntityRelations) #if (!$relations.empty) #**##if ($entity.syntheticCreateMethodAllowed) +#* *##set ($updatableAttributes = $transform.filterUpdatableAttributes($allAttributes, $entity.compositePrimaryKeyPresent)) /** * Constructor with all POJO attribute values and CMR relations. * -#* *##set ($updatableAttributes = $transform.filterUpdatableAttributes($allAttributes, $entity.compositePrimaryKeyPresent)) #* *##foreach($attribute in $updatableAttributes) * @param $attribute.name Value for the ${attribute.name} property #* *##end #* *##foreach ($relation in $relations) - * @param $relation.otherEnd.name Value for the ${relation.otherEnd.name} relation role + * @param $relation.otherEnd.name Value for the ${relation.otherEnd.name} relation #* *##end */ public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)#if(!$updatableAttributes.empty), #end#foreach ($relation in $relations)${relation.otherEnd.getterSetterTypeName} $relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end) |
From: Leif J. <le...@us...> - 2007-02-23 21:19:39
|
User: leifj Date: 07/02/23 13:19:38 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout head.xhtml.vsl layout.xhtml.vsl Log: reach request via the ExternalContext Revision Changes Path 1.3 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/head.xhtml.vsl Index: head.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/head.xhtml.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- head.xhtml.vsl 30 Dec 2006 20:10:22 -0000 1.2 +++ head.xhtml.vsl 23 Feb 2007 21:19:38 -0000 1.3 @@ -9,7 +9,7 @@ <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8"/> <title>#{messages['application.name']}<c:if test="${!empty viewTitle}"> ~ ${viewTitle}</c:if></title> #if ($outputCustomResources) - <link rel="stylesheet" type="text/css" href="/css/custom.css" /> + <link rel="stylesheet" type="text/css" href="${facesContext.externalContext.request.contextPath}/css/custom.css" /> #end <trh:script source="/js/common.js"/> <trh:script source="/js/key-events.js"/> 1.5 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/layout.xhtml.vsl Index: layout.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/layout.xhtml.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- layout.xhtml.vsl 18 Jan 2007 10:11:07 -0000 1.4 +++ layout.xhtml.vsl 23 Feb 2007 21:19:38 -0000 1.5 @@ -11,7 +11,7 @@ <ui:insert name="head"> <ui:include src="head.xhtml"/> </ui:insert> - <c:set var="remoteUser" value="${pageContext.request.remoteUser}" scope="request"/> + <c:set var="remoteUser" value="${facesContext.externalContext.request.userPrincipal.name}" scope="request"/> <trh:body> <tr:form> <ui:insert name="title"/> |
From: Walter M. <wal...@us...> - 2007-02-21 19:41:27
|
User: walterim Date: 07/02/21 11:41:27 Modified: andromda-jsf2/src/main/resources/templates/jsf2/configuration faces-config.xml.vsl web.xml.vsl andromda-jsf2/src/main/uml JSFMetafacadeModel.xml.zip andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades JSFManageableEntityLogicImpl.java Log: Added security (roles) support to the crud feature. Revision Changes Path 1.9 +2 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl Index: faces-config.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- faces-config.xml.vsl 21 Feb 2007 10:11:41 -0000 1.8 +++ faces-config.xml.vsl 21 Feb 2007 19:41:22 -0000 1.9 @@ -131,11 +131,11 @@ <property-name>controllerAction</property-name> <value>init</value> </managed-property> -#set ($securityEnabled = $stringUtils.isNotBlank($securityRealm) && !$manageable.users.empty ) +#set ($securityEnabled = $stringUtils.isNotBlank($securityRealm) && !$manageable.roles.empty ) #if ($securityEnabled) <managed-property> <property-name>roles</property-name> - <value>$manageable.users</value> + <value>$manageable.actionRoles</value> </managed-property> #end <managed-property> 1.8 +3 -3 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/web.xml.vsl Index: web.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/web.xml.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- web.xml.vsl 21 Feb 2007 10:11:41 -0000 1.7 +++ web.xml.vsl 21 Feb 2007 19:41:23 -0000 1.8 @@ -404,10 +404,10 @@ </description> <url-pattern>${manageable.viewFullPath}.${jsfUtils.viewExtension}</url-pattern> </web-resource-collection> -#if (!$manageable.users.empty) +#if (!$manageable.roles.empty) <auth-constraint> -#foreach ($user in $manageable.users) - <role-name>${user.name}</role-name> +#foreach ($role in $manageable.roles) + <role-name>${role.name}</role-name> #end </auth-constraint> #end 1.4 +192 -181 cartridges/andromda-jsf2/src/main/uml/JSFMetafacadeModel.xml.zip <<Binary file>> 1.3 +66 -0 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityLogicImpl.java Index: JSFManageableEntityLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityLogicImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- JSFManageableEntityLogicImpl.java 20 Feb 2007 10:12:05 -0000 1.2 +++ JSFManageableEntityLogicImpl.java 21 Feb 2007 19:41:27 -0000 1.3 @@ -4,12 +4,20 @@ import org.andromda.cartridges.jsf2.JSFUtils; import org.andromda.cartridges.jsf2.JSFProfile; import org.andromda.utils.StringUtilsHelper; +import org.andromda.metafacades.uml.DependencyFacade; +import org.andromda.metafacades.uml.Role; import org.andromda.metafacades.uml.UMLMetafacadeProperties; import org.andromda.metafacades.uml.AttributeFacade; +import org.apache.commons.collections.Closure; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; +import org.apache.commons.collections.Transformer; import org.apache.commons.lang.StringUtils; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.LinkedHashSet; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.andromda.metafacades.uml.ModelElementFacade; @@ -518,4 +526,62 @@ return serialVersionUID; } + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getRoles() + */ + protected Collection handleGetRoles() + { + //copied form the Service <<Metafacade>> + final Collection roles = new ArrayList(this.getTargetDependencies()); + CollectionUtils.filter(roles, new Predicate() + { + public boolean evaluate(final Object object) + { + DependencyFacade dependency = (DependencyFacade)object; + return dependency != null && dependency.getSourceElement() instanceof Role; + } + }); + CollectionUtils.transform(roles, new Transformer() + { + public Object transform(final Object object) + { + return ((DependencyFacade)object).getSourceElement(); + } + }); + final Collection allRoles = new LinkedHashSet(roles); + // add all roles which are generalizations of this one + CollectionUtils.forAllDo(roles, new Closure() + { + public void execute(final Object object) + { + allRoles.addAll(((Role)object).getAllSpecializations()); + } + }); + return allRoles; + } + + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getActionRoles() + */ + protected String handleGetActionRoles() + { + //copied from JSFUseCaseLogicImpl + final Collection users = this.getRoles(); + final StringBuffer rolesBuffer = new StringBuffer(); + boolean first = true; + for (final Iterator userIterator = users.iterator(); userIterator.hasNext();) + { + if (first) + { + first = false; + } + else + { + rolesBuffer.append(','); + } + final Role role = (Role)userIterator.next(); + rolesBuffer.append(role.getName()); + } + return rolesBuffer.toString(); + } } \ No newline at end of file |
From: Walter M. <wal...@us...> - 2007-02-21 10:11:46
|
User: walterim Date: 07/02/21 02:11:42 Modified: andromda-jsf2/src/main/resources/templates/jsf2/configuration faces-config.xml.vsl web.xml.vsl andromda-jsf2 pom.xml Log: Added security support to the crud feature. Revision Changes Path 1.8 +7 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl Index: faces-config.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- faces-config.xml.vsl 20 Feb 2007 10:14:55 -0000 1.7 +++ faces-config.xml.vsl 21 Feb 2007 10:11:41 -0000 1.8 @@ -131,6 +131,13 @@ <property-name>controllerAction</property-name> <value>init</value> </managed-property> +#set ($securityEnabled = $stringUtils.isNotBlank($securityRealm) && !$manageable.users.empty ) +#if ($securityEnabled) + <managed-property> + <property-name>roles</property-name> + <value>$manageable.users</value> + </managed-property> +#end <managed-property> <property-name>outcome</property-name> <value>${manageable.viewFullPath}</value> 1.7 +4 -4 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/web.xml.vsl Index: web.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/web.xml.vsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- web.xml.vsl 12 Feb 2007 11:00:19 -0000 1.6 +++ web.xml.vsl 21 Feb 2007 10:11:41 -0000 1.7 @@ -397,17 +397,17 @@ #foreach ($manageable in $manageables) <security-constraint> <web-resource-collection> - <web-resource-name>$useCase.name resources</web-resource-name> + <web-resource-name>Manage ${manageable.name} resources</web-resource-name> <description> This collection secures all views and resources - as well as the actions called in the "$useCase.name" use-case + as well as the actions called in the "Manage ${manageable.name}" use-case </description> - <url-pattern>${useCase.pathRoot}/*</url-pattern> + <url-pattern>${manageable.viewFullPath}.${jsfUtils.viewExtension}</url-pattern> </web-resource-collection> #if (!$manageable.users.empty) <auth-constraint> #foreach ($user in $manageable.users) - <role-name>$user.name</role-name> + <role-name>${user.name}</role-name> #end </auth-constraint> #end 1.5 +7 -0 cartridges/andromda-jsf2/pom.xml Index: pom.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/pom.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- pom.xml 19 Dec 2006 09:16:14 -0000 1.4 +++ pom.xml 21 Feb 2007 10:11:42 -0000 1.5 @@ -24,6 +24,13 @@ <version>3.2</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.andromda.profiles.uml14</groupId> + <artifactId>andromda-profile</artifactId> + <version>3.2</version> + <type>xml.zip</type> + <scope>runtime</scope> + </dependency> </dependencies> <build> <plugins> |
From: Walter M. <wal...@us...> - 2007-02-20 10:16:37
|
User: walterim Date: 07/02/20 02:16:37 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud view.xhtml.vsl Log: Now the table is allways rendered. Revision Changes Path 1.5 +22 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud/view.xhtml.vsl Index: view.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud/view.xhtml.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- view.xhtml.vsl 18 Jan 2007 10:11:08 -0000 1.4 +++ view.xhtml.vsl 20 Feb 2007 10:16:37 -0000 1.5 @@ -120,7 +120,7 @@ </tr:panelButtonBar> </f:facet> </tr:panelFormLayout> - <tr:table allDetailsEnabled="true" var="row" bandingInterval="1" banding="row" value="#{${formName}.${manageable.listName}}" rows="#{${preferencesBeanName}.maxTableRows}" width="90%" rendered="#{!empty ${formName}.${manageable.listName}}"> + <tr:table allDetailsEnabled="true" var="row" bandingInterval="1" banding="row" value="#{${formName}.${manageable.listName}}" rows="#{${preferencesBeanName}.maxTableRows}" width="90%" rendered="#{${formName}.${manageable.listName} != null}"> <tr:column width="46px"> <f:facet name="header"> <h:panelGroup><t:graphicImage url="/images/space.gif"/></h:panelGroup> @@ -170,9 +170,29 @@ #if($field.hidden) <h:inputHidden id="${field.name}" value="#{${formName}.${field.name}}"/> #else +##esse if está aqui enquanto não se padroniza a questão do enumerator em todo os JSF2 +#if($field.type.enumeration) +#set ($propertyId = $field.name) +#set ($formValuePropertyName = "${formName}.${field.name}") +#set ($multiSelect = $field.type.collectionType || $field.type.arrayType) +#set ($selectBoxType = "selectOneChoice") +#if ($multiSelect) +#set ($selectBoxType = "selectManyListbox") +#end + <tr:$selectBoxType id="$propertyId" value="#{${formValuePropertyName}}" label="#{messages['$field.messageKey']}:" required="$field.required" readOnly="$field.readOnly"#if ($multiSelect) size="$defaultMultiSelectSize"#else unselectedLabel=""#end> + <f:converter converterId="${field.type.fullyQualifiedName}"/> +#foreach ($literal in $field.type.literals) +#if ($literal.type.stringType)#set ($quote = '')#else#set ($quote = '"')#end +#set($literalKey = $literal.name) +#set($literalKey = $literal.defaultValue) + <f:selectItem itemLabel="#{messages['${field.type.messageKey}.${literalKey}']}" itemValue=${quote}${literal.enumerationValue}${quote} /> +#end + </tr:$selectBoxType> +#else #renderActionInput($field "") #end #end +#end #foreach ($field in $manageable.manageableAssociationEnds) #set ($valuePropertyName = $field.name) #set ($backingListName = "${formName}.${field.name}BackingList") |
From: Walter M. <wal...@us...> - 2007-02-20 10:14:55
|
User: walterim Date: 07/02/20 02:14:55 Modified: andromda-jsf2/src/main/resources/templates/jsf2/configuration faces-config.xml.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl Added: andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud ControllerImpl.java.vsl Log: Added the controller implementation to allow overriding the default controller behaviour. Revision Changes Path 1.7 +2 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl Index: faces-config.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- faces-config.xml.vsl 12 Feb 2007 16:54:55 -0000 1.6 +++ faces-config.xml.vsl 20 Feb 2007 10:14:55 -0000 1.7 @@ -54,8 +54,8 @@ #foreach ($manageable in $manageables) <managed-bean> - <managed-bean-name>$manageable.controllerBeanName</managed-bean-name> - <managed-bean-class>$manageable.controllerType</managed-bean-class> + <managed-bean-name>${manageable.controllerBeanName}</managed-bean-name> + <managed-bean-class>${manageable.controllerType}Impl</managed-bean-class> <managed-bean-scope>application</managed-bean-scope> </managed-bean> #end 1.4 +12 -15 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/Controller.java.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- Controller.java.vsl 18 Jan 2007 10:11:10 -0000 1.3 +++ Controller.java.vsl 20 Feb 2007 10:14:55 -0000 1.4 @@ -41,18 +41,18 @@ } public void doInit(${manageable.formBeanType} form) throws Exception { -## does not preload the data anymore... testing. -###if ($manageable.preload) -## final java.util.List list = ${manageable.manageableServiceAccessorCall}.readAll(); -## -## form.${manageable.listSetterName}(list); -## -###if ($manageable.maximumListSize > 0) -## if (list.size() >= $manageable.maximumListSize) -## saveMaxResultsWarning(); -## -###end -###end + +#if ($manageable.preload) + final java.util.List list = ${manageable.manageableServiceAccessorCall}.readAll(); + + form.${manageable.listSetterName}(list); + +#if ($manageable.maximumListSize > 0) + if (list.size() >= $manageable.maximumListSize) + saveMaxResultsWarning(); + +#end +#end #if (!$manageable.manageableAssociationEnds.empty) final java.util.Map backingLists = ${manageable.manageableServiceAccessorCall}.readBackingLists(); #foreach ($member in $manageable.manageableAssociationEnds) @@ -315,9 +315,6 @@ form.${manageable.listSetterName}(list); - if(list.size() == 0) - addWarningMessage(org.andromda.presentation.jsf2.Messages.get("no.entity.found", new Object[]{org.andromda.presentation.jsf2.Messages.get("$manageable.messageKey",null)})); - #if ($manageable.maximumListSize > 0) if (list.size() >= $manageable.maximumListSize) saveMaxResultsWarning(); 1.1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/ControllerImpl.java.vsl Index: ControllerImpl.java.vsl =================================================================== #set ($generatedFile = "${manageable.controllerFullPath}Impl.java") // license-header java merge-point package $manageable.manageablePackageName; /** * @see $controller.fullyQualifiedName */ public class ${manageable.controllerName}Impl extends ${manageable.controllerName} { } |
User: walterim Date: 07/02/20 02:12:08 Modified: andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades JSFManageableEntityAssociationEndLogicImpl.java JSFManageableEntityLogicImpl.java JSFManageableEntityAttributeLogicImpl.java Log: Code cleaning and small bug fixes. Revision Changes Path 1.2 +16 -19 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityAssociationEndLogicImpl.java Index: JSFManageableEntityAssociationEndLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityAssociationEndLogicImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- JSFManageableEntityAssociationEndLogicImpl.java 11 Dec 2006 13:43:57 -0000 1.1 +++ JSFManageableEntityAssociationEndLogicImpl.java 20 Feb 2007 10:12:05 -0000 1.2 @@ -9,7 +9,6 @@ import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; - /** * MetafacadeLogic implementation for org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAssociationEnd. * @@ -18,9 +17,8 @@ public class JSFManageableEntityAssociationEndLogicImpl extends JSFManageableEntityAssociationEndLogic { - public JSFManageableEntityAssociationEndLogicImpl( - Object metaObject, - String context) + + public JSFManageableEntityAssociationEndLogicImpl (Object metaObject, String context) { super(metaObject, context); } @@ -64,26 +62,25 @@ return StringUtilsHelper.toPhrase(messageValue); } - protected boolean handleIsSafeNamePresent() - { - return true; - // TODO será que precisa desse método ? - //return JSFUtils.isSafeName(this.getName()); - } - - protected String handleGetOnlineHelpKey() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAssociationEnd#getOnlineHelpKey() + */ + protected java.lang.String handleGetOnlineHelpKey() { return this.getMessageKey() + ".online.help"; } - protected String handleGetOnlineHelpValue() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAssociationEnd#getOnlineHelpValue() + */ + protected java.lang.String handleGetOnlineHelpValue() { final String value = StringUtilsHelper.toResourceMessage(this.getDocumentation("", 64, false)); return (value == null) ? "No field documentation has been specified" : value; } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getBackingListName(org.andromda.metafacades.uml.ParameterFacade) + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAssociationEnd#getBackingListName() */ protected String handleGetBackingListName() { @@ -96,9 +93,9 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFParameter#getValueListName() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAssociationEnd#getValueListName() */ - protected String handleGetValueListName() + protected java.lang.String handleGetValueListName() { return ObjectUtils.toString(this.getConfiguredProperty(JSFGlobals.VALUE_LIST_PATTERN)).replaceAll( "\\{0\\}", @@ -106,9 +103,9 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFParameter#getLabelListName() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAssociationEnd#getLabelListName() */ - protected String handleGetLabelListName() + protected java.lang.String handleGetLabelListName() { return ObjectUtils.toString(this.getConfiguredProperty(JSFGlobals.LABEL_LIST_PATTERN)).replaceAll( "\\{0\\}", 1.2 +317 -197 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityLogicImpl.java Index: JSFManageableEntityLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityLogicImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- JSFManageableEntityLogicImpl.java 11 Dec 2006 13:43:57 -0000 1.1 +++ JSFManageableEntityLogicImpl.java 20 Feb 2007 10:12:05 -0000 1.2 @@ -23,138 +23,210 @@ public class JSFManageableEntityLogicImpl extends JSFManageableEntityLogic { - /** - * @return the configured property denoting the character sequence to use for the separation of namespaces - */ - private String getNamespaceProperty() + + public JSFManageableEntityLogicImpl (Object metaObject, String context) { - return (String)this.getConfiguredProperty(UMLMetafacadeProperties.NAMESPACE_SEPARATOR); + super (metaObject, context); } - public JSFManageableEntityLogicImpl( - Object metaObject, - String context) + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getViewName() + */ + protected java.lang.String handleGetViewName() { - super(metaObject, context); + return this.getName().toLowerCase() + "-crud"; } - protected String handleGetFormBeanType() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getViewTitleKey() + */ + protected java.lang.String handleGetViewTitleKey() { - return this.getManageablePackageName() + this.getNamespaceProperty() + this.getFormBeanClassName(); + return StringUtilsHelper.toResourceMessageKey(this.getName()) + ".view.title"; } - protected String handleGetFormBeanClassName() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getViewTitleValue() + */ + protected java.lang.String handleGetViewTitleValue() { - return this.getName() + JSFGlobals.FORM_SUFFIX; + return StringUtilsHelper.toPhrase(getName()); } - protected String handleGetFormBeanFullPath() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getListName() + */ + protected java.lang.String handleGetListName() { - return StringUtils.replace(this.getFormBeanType(), this.getNamespaceProperty(), "/"); + return "manageableList"; } - protected java.lang.String handleGetMessageKey() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getFormBeanType() + */ + protected java.lang.String handleGetFormBeanType() { - return StringUtilsHelper.toResourceMessageKey(this.getName()); + return this.getManageablePackageName() + this.getNamespaceProperty() + this.getFormBeanClassName(); } - protected java.lang.String handleGetMessageValue() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getFormBeanName() + */ + protected java.lang.String handleGetFormBeanName() { - return StringUtilsHelper.toPhrase(this.getName()); + return "manage" + this.getName() + JSFGlobals.FORM_SUFFIX; } - protected java.lang.String handleGetViewTitleKey() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getExceptionKey() + */ + protected java.lang.String handleGetExceptionKey() { - return StringUtilsHelper.toResourceMessageKey(this.getName()) + ".view.title"; + return StringUtilsHelper.toResourceMessageKey(this.getName()); } - protected java.lang.String handleGetViewTitleValue() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getActionType() + */ + protected java.lang.String handleGetActionType() { - return StringUtilsHelper.toPhrase(getName()); + return this.getManageablePackageName() + this.getNamespaceProperty() + this.getActionClassName(); } - protected java.lang.String handleGetListName() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getActionFullPath() + */ + protected java.lang.String handleGetActionFullPath() { - return "manageableList"; + return '/' + StringUtils.replace(this.getActionType(), this.getNamespaceProperty(), "/"); } - protected java.lang.String handleGetListGetterName() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getActionPath() + */ + protected java.lang.String handleGetActionPath() { - return "getManageableList"; + return '/' + this.getName() + "/Manage"; } - protected java.lang.String handleGetListSetterName() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getActionClassName() + */ + protected java.lang.String handleGetActionClassName() { - return "setManageableList"; + return "Manage" + getName(); } - protected java.lang.String handleGetActionPath() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getExceptionPath() + */ + protected java.lang.String handleGetExceptionPath() { - return '/' + this.getName() + "/Manage"; + return this.getViewFullPath(); } - protected java.lang.String handleGetFormBeanName() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#isPreload() + */ + protected boolean handleIsPreload() { - return "manage" + this.getName() + JSFGlobals.FORM_SUFFIX; + return false; //TODO think about... +// return this.isCreate() || this.isRead() || this.isUpdate() || this.isDelete(); } - protected java.lang.String handleGetActionType() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getFormBeanClassName() + */ + protected java.lang.String handleGetFormBeanClassName() { - return this.getManageablePackageName() + this.getNamespaceProperty() + this.getActionClassName(); + return this.getName() + JSFGlobals.FORM_SUFFIX; } - protected java.lang.String handleGetExceptionKey() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getFormBeanFullPath() + */ + protected java.lang.String handleGetFormBeanFullPath() { - return StringUtilsHelper.toResourceMessageKey(this.getName()) + ".exception"; + return StringUtils.replace(this.getFormBeanType(), this.getNamespaceProperty(), "/"); } - protected java.lang.String handleGetExceptionPath() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getListGetterName() + */ + protected java.lang.String handleGetListGetterName() { - return this.getViewFullPath(); + return "getManageableList"; } - protected java.lang.String handleGetActionFullPath() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getListSetterName() + */ + protected java.lang.String handleGetListSetterName() { - return '/' + StringUtils.replace(this.getActionType(), this.getNamespaceProperty(), "/"); + return "setManageableList"; } - protected java.lang.String handleGetActionClassName() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getMessageKey() + */ + protected java.lang.String handleGetMessageKey() { - return "Manage" + getName(); + return StringUtilsHelper.toResourceMessageKey(this.getName()); } - protected boolean handleIsPreload() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getMessageValue() + */ + protected java.lang.String handleGetMessageValue() { - return this.isCreate() || this.isRead() || this.isUpdate() || this.isDelete(); + return StringUtilsHelper.toPhrase(this.getName()); } - protected String handleGetOnlineHelpKey() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getOnlineHelpKey() + */ + protected java.lang.String handleGetOnlineHelpKey() { return this.getMessageKey() + ".online.help"; } - protected String handleGetOnlineHelpValue() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getOnlineHelpValue() + */ + protected java.lang.String handleGetOnlineHelpValue() { final String value = StringUtilsHelper.toResourceMessage(this.getDocumentation("", 64, false)); return (value == null) ? "No entity documentation has been specified" : value; } - protected String handleGetOnlineHelpActionPath() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getOnlineHelpActionPath() + */ + protected java.lang.String handleGetOnlineHelpActionPath() { return this.getActionPath() + "Help"; } - protected String handleGetOnlineHelpPagePath() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getOnlineHelpPagePath() + */ + protected java.lang.String handleGetOnlineHelpPagePath() { return '/' + this.getManageablePackagePath() + '/' + this.getName().toLowerCase() + "_help"; } + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#isTableExportable() + */ protected boolean handleIsTableExportable() { return this.getTableExportTypes().indexOf("none") == -1; } - protected String handleGetTableExportTypes() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getTableExportTypes() + */ + protected java.lang.String handleGetTableExportTypes() { return null; //TODO a resolver @@ -163,14 +235,9 @@ // (String)getConfiguredProperty(JSFGlobals.PROPERTY_DEFAULT_TABLE_EXPORT_TYPES) ); } - protected boolean handleIsTableSortable() - { - final Object taggedValue = this.findTaggedValue(JSFProfile.TAGGEDVALUE_TABLE_SORTABLE); - return (taggedValue == null) - ? JSFProfile.TAGGEDVALUE_TABLE_SORTABLE_DEFAULT_VALUE - : Boolean.valueOf(String.valueOf(taggedValue)).booleanValue(); - } - + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getTableMaxRows() + */ protected int handleGetTableMaxRows() { final Object taggedValue = this.findTaggedValue(JSFProfile.TAGGEDVALUE_TABLE_MAXROWS); @@ -189,7 +256,18 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getControllerFullyQualifiedName() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#isTableSortable() + */ + protected boolean handleIsTableSortable() + { + final Object taggedValue = this.findTaggedValue(JSFProfile.TAGGEDVALUE_TABLE_SORTABLE); + return (taggedValue == null) + ? JSFProfile.TAGGEDVALUE_TABLE_SORTABLE_DEFAULT_VALUE + : Boolean.valueOf(String.valueOf(taggedValue)).booleanValue(); + } + + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getControllerType() */ protected java.lang.String handleGetControllerType(){ return this.getManageablePackageName() + this.getNamespaceProperty() + this.getControllerName(); @@ -198,72 +276,39 @@ /** * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getControllerBeanName() */ - protected java.lang.String handleGetControllerBeanName(){ + protected java.lang.String handleGetControllerBeanName() + { return StringUtils.uncapitalize(this.getName()) + "Controller"; } + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getControllerFullPath() + */ protected java.lang.String handleGetControllerFullPath() { return "/" + StringUtils.replace(this.getControllerType(), this.getNamespaceProperty(), "/"); } + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getControllerName() + */ protected java.lang.String handleGetControllerName() { return this.getName() + "Controller"; } + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getValueObjectClassName() + */ protected java.lang.String handleGetValueObjectClassName() { - return this.getName() + "ValueObject"; -//TODO rever return getName() + this.getConfiguredProperty(SpringGlobals.CRUD_VALUE_OBJECT_SUFFIX); - } - - private void addSerialUIDData(StringBuffer buffer){ - for (final Iterator iterator = this.getManageableAttributes().iterator(); iterator.hasNext();) - { - final ModelElementFacade parameter = (ModelElementFacade)iterator.next(); - buffer.append(parameter.getName()); - } - for (final Iterator iterator = this.getManageableAssociationEnds().iterator(); iterator.hasNext();) - { - final ModelElementFacade parameter = (ModelElementFacade)iterator.next(); - buffer.append(parameter.getName()); - } - - } - - private String calcSerialVersionUID(StringBuffer buffer){ - final String signature = buffer.toString(); - String serialVersionUID = String.valueOf(0L); - try - { - MessageDigest md = MessageDigest.getInstance("SHA"); - byte[] hashBytes = md.digest(signature.getBytes()); - - long hash = 0; - for (int ctr = Math.min( - hashBytes.length, - 8) - 1; ctr >= 0; ctr--) - { - hash = (hash << 8) | (hashBytes[ctr] & 0xFF); - } - serialVersionUID = String.valueOf(hash); - } - catch (final NoSuchAlgorithmException exception) - { - final String message = "Error performing JSFAction.getFormSerialVersionUID"; - logger.error( - message, - exception); - } - - return serialVersionUID; + return getName() + this.getConfiguredProperty(JSFGlobals.CRUD_VALUE_OBJECT_SUFFIX); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAction#getFormSerialVersionUID() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getFormSerialVersionUID() */ - protected String handleGetFormSerialVersionUID() + protected java.lang.String handleGetFormSerialVersionUID() { final StringBuffer buffer = new StringBuffer(); @@ -275,9 +320,9 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAction#getFormSerialVersionUID() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getActionSerialVersionUID() */ - protected String handleGetActionSerialVersionUID() + protected java.lang.String handleGetActionSerialVersionUID() { final StringBuffer buffer = new StringBuffer(); @@ -289,9 +334,9 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAction#getPopulator() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getPopulatorName() */ - protected String handleGetPopulatorName() + protected java.lang.String handleGetPopulatorName() { return ObjectUtils.toString(this.getConfiguredProperty(JSFGlobals.VIEW_POPULATOR_PATTERN)).replaceAll( "\\{0\\}", @@ -299,43 +344,41 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAction#getPopulator() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getPopulatorFullPath() */ - protected String handleGetPopulatorType() + protected java.lang.String handleGetPopulatorFullPath() { - return this.getManageablePackageName() + this.getNamespaceProperty() + this.getPopulatorName(); + return "/" + StringUtils.replace(this.getPopulatorType(), this.getNamespaceProperty(), "/"); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAction#getPopulator() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getPopulatorType() */ - protected String handleGetPopulatorFullPath() + protected java.lang.String handleGetPopulatorType() { - return "/" + StringUtils.replace(this.getPopulatorType(), this.getNamespaceProperty(), "/"); + return this.getManageablePackageName() + this.getNamespaceProperty() + this.getPopulatorName(); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFView#getFormKey() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getFormKey() */ - protected String handleGetFormKey() + protected java.lang.String handleGetFormKey() { final Object formKeyValue = this.findTaggedValue(JSFProfile.TAGGEDVALUE_ACTION_FORM_KEY); return formKeyValue == null ? ObjectUtils.toString(this.getConfiguredProperty(JSFGlobals.ACTION_FORM_KEY)) : String.valueOf(formKeyValue); } - protected String handleGetViewName() - { - return this.getName().toLowerCase() + "-crud"; - } - - protected String handleGetViewFullPath() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getViewFullPath() + */ + protected java.lang.String handleGetViewFullPath() { return '/' + this.getManageablePackagePath() + '/' + this.getViewName(); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAction#handleGetHiddenParameters() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#isValidationRequired() */ protected boolean handleIsValidationRequired() { @@ -350,27 +393,43 @@ return false; } - protected String handleGetSearchFormBeanType() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getSearchFormBeanName() + */ + protected java.lang.String handleGetSearchFormBeanName() { - return this.getManageablePackageName() + this.getNamespaceProperty() + this.getSearchFormBeanClassName(); + return "manage" + this.getName() + "Search" + JSFGlobals.FORM_SUFFIX; } - protected String handleGetSearchFormBeanClassName() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getSearchFormBeanType() + */ + protected java.lang.String handleGetSearchFormBeanType() { - return this.getName() + "Search" + JSFGlobals.FORM_SUFFIX; + return this.getManageablePackageName() + this.getNamespaceProperty() + this.getSearchFormBeanClassName(); } - protected String handleGetSearchFormBeanFullPath() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getSearchFormBeanFullPath() + */ + protected java.lang.String handleGetSearchFormBeanFullPath() { return StringUtils.replace(this.getSearchFormBeanType(), this.getNamespaceProperty(), "/"); } - protected java.lang.String handleGetSearchFormBeanName() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getSearchFormBeanClassName() + */ + protected java.lang.String handleGetSearchFormBeanClassName() { - return "manage" + this.getName() + "Search" + JSFGlobals.FORM_SUFFIX; + return this.getName() + "Search" + JSFGlobals.FORM_SUFFIX; } - protected java.util.Collection handleGetManageableSearchAttributes(){ + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getManageableSearchAttributes() + */ + protected java.util.Collection handleGetManageableSearchAttributes() + { final Collection coll=new java.util.ArrayList(); for(final java.util.Iterator it=getManageableAttributes().iterator(); it.hasNext(); ){ final JSFManageableEntityAttribute attr=(JSFManageableEntityAttribute)it.next(); @@ -380,12 +439,19 @@ return coll; } - protected java.util.Collection handleGetManageableSearchAssociationEnds(){ + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getManageableSearchAssociationEnds() + */ + protected java.util.Collection handleGetManageableSearchAssociationEnds() + { return getManageableAssociationEnds(); } - protected boolean handleIsSearchable(Object element){ - + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#isSearchable(java.lang.Object) + */ + protected boolean handleIsSearchable(java.lang.Object element) + { // if(element instanceof JSFManageableEntityAttribute) // return getManageableSearchAttributes().contains(element); // else @@ -398,4 +464,58 @@ else return true; } + + /** + * @return the configured property denoting the character sequence to use for the separation of namespaces + */ + private String getNamespaceProperty() + { + return (String)this.getConfiguredProperty(UMLMetafacadeProperties.NAMESPACE_SEPARATOR); + } + + private void addSerialUIDData(StringBuffer buffer){ + for (final Iterator iterator = this.getManageableAttributes().iterator(); iterator.hasNext();) + { + final ModelElementFacade parameter = (ModelElementFacade)iterator.next(); + buffer.append(parameter.getName()); + } + for (final Iterator iterator = this.getManageableAssociationEnds().iterator(); iterator.hasNext();) + { + final ModelElementFacade parameter = (ModelElementFacade)iterator.next(); + buffer.append(parameter.getName()); + } + + } + + /** + * @return the calculated SerialVersionUID + */ + private String calcSerialVersionUID(StringBuffer buffer){ + final String signature = buffer.toString(); + String serialVersionUID = String.valueOf(0L); + try + { + MessageDigest md = MessageDigest.getInstance("SHA"); + byte[] hashBytes = md.digest(signature.getBytes()); + + long hash = 0; + for (int ctr = Math.min( + hashBytes.length, + 8) - 1; ctr >= 0; ctr--) + { + hash = (hash << 8) | (hashBytes[ctr] & 0xFF); + } + serialVersionUID = String.valueOf(hash); + } + catch (final NoSuchAlgorithmException exception) + { + final String message = "Error performing JSFAction.getFormSerialVersionUID"; + logger.error( + message, + exception); + } + + return serialVersionUID; + } + } \ No newline at end of file 1.2 +197 -173 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityAttributeLogicImpl.java Index: JSFManageableEntityAttributeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityAttributeLogicImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- JSFManageableEntityAttributeLogicImpl.java 11 Dec 2006 13:43:57 -0000 1.1 +++ JSFManageableEntityAttributeLogicImpl.java 20 Feb 2007 10:12:05 -0000 1.2 @@ -9,7 +9,6 @@ import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; - /** * MetafacadeLogic implementation for org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute. * @@ -18,15 +17,14 @@ public class JSFManageableEntityAttributeLogicImpl extends JSFManageableEntityAttributeLogic { - public JSFManageableEntityAttributeLogicImpl( - Object metaObject, - String context) + + public JSFManageableEntityAttributeLogicImpl (Object metaObject, String context) { super(metaObject, context); } /** - * @see JSFManageableEntityAttribute#getMessageKey() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getMessageKey() */ protected java.lang.String handleGetMessageKey() { @@ -42,33 +40,16 @@ } /** - * @see JSFManageableEntityAttribute#getMessageValue() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getMessageValue() */ protected java.lang.String handleGetMessageValue() { return StringUtilsHelper.toPhrase(getName()); } - private String internalGetDateFormat() - { - String dateFormat = null; - - if (this.getType() != null && this.getType().isDateType()) - { - final Object taggedValueObject = this.findTaggedValue(JSFProfile.TAGGEDVALUE_INPUT_FORMAT); - if (taggedValueObject == null) - { - dateFormat = (String)this.getConfiguredProperty(JSFGlobals.PROPERTY_DEFAULT_DATEFORMAT); - } - else - { - dateFormat = taggedValueObject.toString(); - } - } - - return dateFormat; - } - + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getDateFormat() + */ protected java.lang.String handleGetDateFormat() { String dateFormat = this.internalGetDateFormat(); @@ -90,43 +71,61 @@ return dateFormat; } - protected boolean handleIsStrictDateFormat() - { - final String dateFormat = this.internalGetDateFormat(); - return (dateFormat != null && dateFormat.trim().startsWith("strict")); - } - + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isNeedsFileUpload() + */ protected boolean handleIsNeedsFileUpload() { return this.getType() != null && this.getType().isBlobType(); } + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isHidden() + */ protected boolean handleIsHidden() { return !this.isDisplay() || JSFProfile.TAGGEDVALUE_INPUT_TYPE_HIDDEN.equals(this.getWidgetType()); } - protected String handleGetWidgetType() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getWidgetType() + */ + protected java.lang.String handleGetWidgetType() { final Object widgetTag = findTaggedValue(JSFProfile.TAGGEDVALUE_INPUT_TYPE); return (widgetTag == null) ? JSFProfile.TAGGEDVALUE_INPUT_TYPE_TEXT : widgetTag.toString(); } - protected String handleGetOnlineHelpKey() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isStrictDateFormat() + */ + protected boolean handleIsStrictDateFormat() + { + final String dateFormat = this.internalGetDateFormat(); + return (dateFormat != null && dateFormat.trim().startsWith("strict")); + } + + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getOnlineHelpKey() + */ + protected java.lang.String handleGetOnlineHelpKey() { return this.getMessageKey() + ".online.help"; } - protected String handleGetOnlineHelpValue() + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getOnlineHelpValue() + */ + protected java.lang.String handleGetOnlineHelpValue() { final String value = StringUtilsHelper.toResourceMessage(this.getDocumentation("", 64, false)); return (value == null) ? "No field documentation has been specified" : value; } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getFormat() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getFormat() */ - protected String handleGetFormat() + protected java.lang.String handleGetFormat() { return JSFUtils.getFormat( (ModelElementFacade)this.THIS(), @@ -136,43 +135,43 @@ } /** - * @return the default time format pattern as defined using the configured property + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getDefaultDateFormat() */ - protected String handleGetDefaultTimeFormat() + protected java.lang.String handleGetDefaultDateFormat() { - return (String)this.getConfiguredProperty(JSFGlobals.PROPERTY_DEFAULT_TIMEFORMAT); + return (String)this.getConfiguredProperty(JSFGlobals.PROPERTY_DEFAULT_DATEFORMAT); } /** - * @return the default date format pattern as defined using the configured property + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getDefaultTimeFormat() */ - protected String handleGetDefaultDateFormat() + protected java.lang.String handleGetDefaultTimeFormat() { - return (String)this.getConfiguredProperty(JSFGlobals.PROPERTY_DEFAULT_DATEFORMAT); + return (String)this.getConfiguredProperty(JSFGlobals.PROPERTY_DEFAULT_TIMEFORMAT); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getDateFormatter(org.andromda.cartridges.jsf2.metafacades.JSFParameter) + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getDateFormatter() */ - protected String handleGetDateFormatter() + protected java.lang.String handleGetDateFormatter() { final ClassifierFacade type = this.getType(); return type != null && type.isDateType() ? this.getName() + "DateFormatter" : null; } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getTimeFormatter(org.andromda.cartridges.jsf2.metafacades.JSFParameter) + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getTimeFormatter() */ - protected String handleGetTimeFormatter() + protected java.lang.String handleGetTimeFormatter() { final ClassifierFacade type = this.getType(); return type != null && type.isTimeType() ? this.getName() + "TimeFormatter" : null; } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getBackingListName(org.andromda.metafacades.uml.ParameterFacade) + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getBackingListName() */ - protected String handleGetBackingListName() + protected java.lang.String handleGetBackingListName() { final String backingListName = StringUtils.replace( @@ -183,9 +182,9 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFParameter#getValueListName() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getValueListName() */ - protected String handleGetValueListName() + protected java.lang.String handleGetValueListName() { return ObjectUtils.toString(this.getConfiguredProperty(JSFGlobals.VALUE_LIST_PATTERN)).replaceAll( "\\{0\\}", @@ -193,9 +192,9 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFParameter#getLabelListName() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getLabelListName() */ - protected String handleGetLabelListName() + protected java.lang.String handleGetLabelListName() { return ObjectUtils.toString(this.getConfiguredProperty(JSFGlobals.LABEL_LIST_PATTERN)).replaceAll( "\\{0\\}", @@ -203,25 +202,25 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isValidationRequired() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getValidatorTypes() */ - protected boolean handleIsValidationRequired() + protected java.util.Collection handleGetValidatorTypes() { - return !this.getValidatorTypes().isEmpty(); + return JSFUtils.getValidatorTypes( + (ModelElementFacade)this.THIS(), + this.getType()); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getValidatorTypes() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isValidationRequired() */ - protected java.util.Collection handleGetValidatorTypes() + protected boolean handleIsValidationRequired() { - return JSFUtils.getValidatorTypes( - (ModelElementFacade)this.THIS(), - this.getType()); + return !this.getValidatorTypes().isEmpty(); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFParameter#getValidatorVars() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getValidatorVars() */ protected java.util.Collection handleGetValidatorVars() { @@ -231,7 +230,7 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getValidWhen() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getValidWhen() */ protected java.lang.String handleGetValidWhen() { @@ -239,41 +238,35 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getValidatorArgs(java.lang.String) + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputCheckbox() */ - protected java.util.Collection handleGetValidatorArgs(final String validatorType) + protected boolean handleIsInputCheckbox() { - return JSFUtils.getValidatorArgs( - (ModelElementFacade)this.THIS(), - validatorType); - } - - /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputTextarea() - */ - protected boolean handleIsInputTextarea() + boolean checkbox = this.isInputType(JSFGlobals.INPUT_CHECKBOX); + if (!checkbox && this.getInputType().length() == 0) { - return this.isInputType(JSFGlobals.INPUT_TEXTAREA); + final ClassifierFacade type = this.getType(); + checkbox = type != null ? type.isBooleanType() : false; } - - /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputSelect() - */ - protected boolean handleIsInputSelect() - { - return this.isInputType(JSFGlobals.INPUT_SELECT); + return checkbox; } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputSecret() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputFile() */ - protected boolean handleIsInputSecret() + protected boolean handleIsInputFile() { - return this.isInputType(JSFGlobals.INPUT_PASSWORD); + boolean file = false; + ClassifierFacade type = getType(); + if (type != null) + { + file = type.isFileType() || type.isBlobType(); + } + return file; } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputHidden() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputHidden() */ protected boolean handleIsInputHidden() { @@ -281,15 +274,15 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isPlaintext() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputMultibox() */ - protected boolean handleIsPlaintext() + protected boolean handleIsInputMultibox() { - return this.isInputType(JSFGlobals.PLAIN_TEXT); + return this.isInputType(JSFGlobals.INPUT_MULTIBOX); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputRadio() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputRadio() */ protected boolean handleIsInputRadio() { @@ -297,23 +290,23 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputText() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputSecret() */ - protected boolean handleIsInputText() + protected boolean handleIsInputSecret() { - return this.isInputType(JSFGlobals.INPUT_TEXT); + return this.isInputType(JSFGlobals.INPUT_PASSWORD); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputMultibox() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputSelect() */ - protected boolean handleIsInputMultibox() + protected boolean handleIsInputSelect() { - return this.isInputType(JSFGlobals.INPUT_MULTIBOX); + return this.isInputType(JSFGlobals.INPUT_SELECT); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputTable() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputTable() */ protected boolean handleIsInputTable() { @@ -321,84 +314,31 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputCheckbox() - */ - protected boolean handleIsInputCheckbox() - { - boolean checkbox = this.isInputType(JSFGlobals.INPUT_CHECKBOX); - if (!checkbox && this.getInputType().length() == 0) - { - final ClassifierFacade type = this.getType(); - checkbox = type != null ? type.isBooleanType() : false; - } - return checkbox; - } - - /** - * Gets the current value of the specified input type (or an empty string - * if one isn't specified). - * - * @return the input type name. + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getInputTableIdentifierColumns() */ - private final String getInputType() + protected java.lang.String handleGetInputTableIdentifierColumns() { - return ObjectUtils.toString(this.findTaggedValue(JSFProfile.TAGGEDVALUE_INPUT_TYPE)).trim(); - } - - /** - * Indicates whether or not this parameter is of the given input type. - * - * @param inputType the name of the input type to check for. - * @return true/false - */ - private final boolean isInputType(final String inputType) - { - return inputType.equalsIgnoreCase(this.getInputType()); - } - - /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputFile() - */ - protected boolean handleIsInputFile() - { - boolean file = false; - ClassifierFacade type = getType(); - if (type != null) - { - file = type.isFileType() || type.isBlobType(); - } - return file; - } - - /** - * Overridden to provide consistent behavior with {@link JSFParameter#isReadOnly()}. - * - * @see org.andromda.metafacades.uml.AttributeFacade#isReadOnly() - */ - public boolean isReadOnly() - { - return JSFUtils.isReadOnly(this); + return ObjectUtils.toString(this.findTaggedValue(JSFProfile.TAGGEDVALUE_INPUT_TABLE_IDENTIFIER_COLUMNS)).trim(); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getValueListDummyValue() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputText() */ - protected String handleGetValueListDummyValue() + protected boolean handleIsInputText() { - return this.constructDummyArray(); + return this.isInputType(JSFGlobals.INPUT_TEXT); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isEqualValidator() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputTextarea() */ - protected boolean handleIsEqualValidator() + protected boolean handleIsInputTextarea() { - final String equal = JSFUtils.getEqual((ModelElementFacade)this.THIS()); - return equal != null && equal.trim().length() > 0; + return this.isInputType(JSFGlobals.INPUT_TEXTAREA); } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#isInputTypePresent() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isInputTypePresent() */ protected boolean handleIsInputTypePresent() { @@ -414,16 +354,9 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttributer#getInputTableIdentifierColumns() - */ - protected String handleGetInputTableIdentifierColumns() - { - return ObjectUtils.toString(this.findTaggedValue(JSFProfile.TAGGEDVALUE_INPUT_TABLE_IDENTIFIER_COLUMNS)).trim(); - } - /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getDummyValue() + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getDummyValue() */ - protected String handleGetDummyValue() + protected java.lang.String handleGetDummyValue() { final ClassifierFacade type = this.getType(); if (type != null) @@ -531,6 +464,73 @@ } /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isEqualValidator() + */ + protected boolean handleIsEqualValidator() + { + final String equal = JSFUtils.getEqual((ModelElementFacade)this.THIS()); + return equal != null && equal.trim().length() > 0; + } + + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#isPlaintext() + */ + protected boolean handleIsPlaintext() + { + return this.isInputType(JSFGlobals.PLAIN_TEXT); + } + + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getValueListDummyValue() + */ + protected java.lang.String handleGetValueListDummyValue() + { + return this.constructDummyArray(); + } + + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttribute#getValidatorArgs(java.lang.String) + */ + protected java.util.Collection handleGetValidatorArgs(java.lang.String validatorType) + { + return JSFUtils.getValidatorArgs( + (ModelElementFacade)this.THIS(), + validatorType); + } + + /** + * Gets the current value of the specified input type (or an empty string + * if one isn't specified). + * + * @return the input type name. + */ + private final String getInputType() + { + return ObjectUtils.toString(this.findTaggedValue(JSFProfile.TAGGEDVALUE_INPUT_TYPE)).trim(); + } + + /** + * Indicates whether or not this parameter is of the given input type. + * + * @param inputType the name of the input type to check for. + * @return true/false + */ + private final boolean isInputType(final String inputType) + { + return inputType.equalsIgnoreCase(this.getInputType()); + } + + /** + * Overridden to provide consistent behavior with {@link JSFParameter#isReadOnly()}. + * + * @see org.andromda.metafacades.uml.AttributeFacade#isReadOnly() + */ + public boolean isReadOnly() + { + return JSFUtils.isReadOnly(this); + } + + /** * Constructs a string representing an array initialization in Java. * * @return A String representing Java code for the initialization of an array. @@ -541,4 +541,28 @@ this.getName(), JSFGlobals.DUMMY_ARRAY_COUNT); } + + private String internalGetDateFormat() + { + String dateFormat = null; + + if (this.getType() != null && this.getType().isDateType()) + { + final Object taggedValueObject = this.findTaggedValue(JSFProfile.TAGGEDVALUE_INPUT_FORMAT); + if (taggedValueObject == null) + { + dateFormat = (String)this.getConfiguredProperty(JSFGlobals.PROPERTY_DEFAULT_DATEFORMAT); + } + else + { + dateFormat = taggedValueObject.toString(); + } + } + + return dateFormat; + } + + + + } \ No newline at end of file |
From: Walter M. <wal...@us...> - 2007-02-20 10:10:32
|
User: walterim Date: 07/02/20 02:10:32 Modified: andromda-jsf2/src/main/resources/META-INF/andromda cartridge.xml metafacades.xml namespace.xml andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2 JSFGlobals.java Log: Added the "crudValueObjectSuffix" property. The suffix to append to the class names of CRUD value objects. Revision Changes Path 1.4 +13 -19 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- cartridge.xml 11 Jan 2007 17:35:19 -0000 1.3 +++ cartridge.xml 20 Feb 2007 10:10:32 -0000 1.4 @@ -70,6 +70,7 @@ <property reference="manageableFormName"/> <property reference="manageableFieldMaxLength"/> <property reference="manageableReferenceParameterPrefix"/> + <property reference="crudValueObjectSuffix"/> <!-- cartridge-property merge-point --> @@ -610,25 +611,6 @@ outputCondition="viewTypeIsFacelets"/> <template - path="templates/jsf2/views/facelets/layout/menu.xhtml.vsl" - outputPattern="layout/menu.xhtml" - outlet="views" - overwrite="true" - outputToSingleFile="true" - outputCondition="viewTypeIsFacelets"> - <modelElements> - <modelElement variable="useCases"> - <type name="org.andromda.metafacades.uml.FrontEndUseCase"> - <property name="registrationUseCase">false</property> - </type> - </modelElement> - <modelElement variable="manageables"> - <type name="org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity"/> - </modelElement> - </modelElements> - </template> - - <template path="templates/jsf2/views/facelets/layout/footer.xhtml.vsl" outputPattern="layout/footer.xhtml" outlet="views" @@ -945,6 +927,18 @@ </template> <template + path="templates/jsf2/controllers/crud/ControllerImpl.java.vsl" + outputPattern="$generatedFile" + outlet="controller-impls" + overwrite="false"> + <modelElements variable="manageable"> + <modelElement> + <type name="org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity"/> + </modelElement> + </modelElements> + </template> + + <template path="templates/jsf2/forms/crud/Form.java.vsl" outputPattern="$generatedFile" outlet="forms" 1.3 +1 -0 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/metafacades.xml Index: metafacades.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/metafacades.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- metafacades.xml 11 Dec 2006 13:43:58 -0000 1.2 +++ metafacades.xml 20 Feb 2007 10:10:32 -0000 1.3 @@ -129,6 +129,7 @@ <stereotype>ENTITY</stereotype> <stereotype>MANAGEABLE</stereotype> </mapping> + <property reference="crudValueObjectSuffix"/> <property reference="defaultTableExportTypes"/> <property reference="viewPopulatorPattern"/> <property reference="actionFormKey"/> 1.3 +6 -0 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/namespace.xml Index: namespace.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/namespace.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- namespace.xml 11 Dec 2006 13:43:58 -0000 1.2 +++ namespace.xml 20 Feb 2007 10:10:32 -0000 1.3 @@ -69,6 +69,12 @@ The forms to which input is stored are output here. </documentation> </property> + <property name="crudValueObjectSuffix"> + <default>ValueObject</default> + <documentation> + The suffix to append to the names of generated value objects used in CRUD (manageable entities). + </documentation> + </property> </propertyGroup> <propertyGroup name="Configuration"> <documentation> 1.3 +4 -0 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/JSFGlobals.java Index: JSFGlobals.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/JSFGlobals.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- JSFGlobals.java 11 Dec 2006 13:43:58 -0000 1.2 +++ JSFGlobals.java 20 Feb 2007 10:10:32 -0000 1.3 @@ -9,6 +9,10 @@ { /** + * The suffix to append to the class names of CRUD value objects. + */ + public static final String CRUD_VALUE_OBJECT_SUFFIX = "crudValueObjectSuffix"; + /** * A space-separated list of types to which displaytag table are to be exported by default. */ public static final String PROPERTY_DEFAULT_TABLE_EXPORT_TYPES = "defaultTableExportTypes"; |
From: Manish A. <mag...@us...> - 2007-02-19 06:54:20
|
User: magrawal Date: 07/02/18 22:54:20 Modified: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit AndroMDA.ScenarioUnit.csproj CodeAsserterAttribute.cs CodeDataProviderAttribute.cs IAsserter.cs IDataProvider.cs TestScenarioHelper.cs XMLAsserterAttribute.cs XMLDataProviderAttribute.cs Log: added documentation. Revision Changes Path 1.3 +2 -1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.csproj Index: AndroMDA.ScenarioUnit.csproj =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- AndroMDA.ScenarioUnit.csproj 14 Jan 2007 04:21:44 -0000 1.2 +++ AndroMDA.ScenarioUnit.csproj 19 Feb 2007 06:54:19 -0000 1.3 @@ -15,10 +15,11 @@ <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> + <DefineConstants>TRACE;DEBUG;w</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>AnyCPU</PlatformTarget> + <DocumentationFile>bin\debug\AndroMDA.ScenarioUnit.XML</DocumentationFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> 1.2 +81 -6 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeAsserterAttribute.cs Index: CodeAsserterAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeAsserterAttribute.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- CodeAsserterAttribute.cs 10 Jan 2007 22:56:52 -0000 1.1 +++ CodeAsserterAttribute.cs 19 Feb 2007 06:54:19 -0000 1.2 @@ -4,18 +4,93 @@ using System.Reflection; namespace AndroMDA.ScenarioUnit { + /// <summary> + /// This is a concrete implementation of the <see cref="IAsserter"/> interface + /// that uses helper methods to assert actual output from a test case against expected output. + /// </summary> + /// <remarks> + /// This asserter is similar to the traditional mechanism of using + /// helper methods to separate out assertion logic from the main testing code. + /// <para> + /// This asserter is helpful when used in conjunction with <see cref="XmlAsserter"/> for return values/output parameters + /// that cannot be serialized into XML. + /// </para> + /// <para> + /// This class derives from the <c>System.Attribute</c> class. This + /// allows this class to be configured as the asserter for a test method return value or output parameter. + /// </para> + /// <para> + /// The AttributeUsage attribute for this class: + /// <c>[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)]</c> + /// ensures that this attribute can be applied at a class, method or at a parameter level. + /// </para> + /// <para> + /// When this attribute is specified at a <c>TestFixture</c> level, + /// all the test method return values and output parameters in that <c>TestFixture</c> are asserted using this asserter + /// unless, if a different asserter is specified at a test method or parameter level. + /// When this asserter is specified as an attribute on the test method, it + /// overrides any asserter configured at the test fixture level. + /// Similarly, when specified at the return value or output parameter level, + /// this data provider is used to assert that parameter, irrespective of the asserter configured at the test method or test fixture levels. + /// </para> + /// </remarks> [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Parameter)] public class CodeAsserterAttribute : Attribute, IAsserter { private string _asserterMethodName; + + /// <summary> + /// This is an optional property to specify the name of the helper method that is called + /// to assert actual output against expected output. + /// </summary> + /// <remarks> + /// If this property is not set, a naiming convention is used to identify the method to be called. + /// The naming convention is: + /// <code escaped="true"> + /// [testMethodName_[parameterName]_assert() + /// </code> + /// <note> + /// In case of return values, there is no "parameterName" part in the naming convention. + /// </note> + /// </remarks> public string AsserterMethodName { get { return _asserterMethodName; } set { _asserterMethodName = value; } } + /// <summary> + /// This is the implementation of the <see cref="IAsserter"/> interface. + /// It uses a helper method to assert actual output against expected test output. + /// </summary> + /// <param name="outputObj">The object containing the actual test output</param> + /// <param name="pInfo">Meta information about the <paramref name="outputObj"/>.</param> + /// <param name="methodName">The name of the test method. This name is used to identify the helper assertion method using a naming convention.</param> + /// <param name="scenarioName">The name of the test scenario.</param> + /// <param name="testFixture">A reference to the object containing the helper method. + /// Usually, this is a reference to the TestFixture itself.</param> + /// <remarks> + /// If the <see cref="AsserterMethodName"/>property is not specified, this data provider uses a + /// naming convention to identify the helper method to + /// be called. + /// <para> + /// The naming convention used is: + /// </para> + ///<code escaped="true"> + /// [testMethodName]_[parameterName]_Assert() + /// </code> + /// <para> + /// The helper method must be a private instance method that has the following signature: + /// </para> + /// <code escaped="true" lang="c#"> + ///private void [testMethodName]_[parameterName]_Assert(object outputObj, ParameterInfo pInfo, string methodName, string scenarioName) + /// </code> + /// <note> + /// To assert return values, the "parameterName" part of the helper method name is ommited. + /// </note> + /// </remarks> public void AssertOutput(Object outputObj, ParameterInfo pInfo, string methodName, string scenarioName, object testFixture) { 1.3 +84 -0 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeDataProviderAttribute.cs Index: CodeDataProviderAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeDataProviderAttribute.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- CodeDataProviderAttribute.cs 18 Jan 2007 10:49:48 -0000 1.2 +++ CodeDataProviderAttribute.cs 19 Feb 2007 06:54:19 -0000 1.3 @@ -4,18 +4,102 @@ using System.Reflection; namespace AndroMDA.ScenarioUnit { + /// <summary> + /// This is a concrete implementation of the <see cref="IDataProvider"/> interface. + /// This data provider uses helper methods written in the TestFixture class + /// or a separate class to load input data for test cases. + /// </summary> + /// <remarks> + /// This data provider uses reflection ot execute a helper method + /// on an object reference to load the test data for a specific scenario. + /// This method of loading test data is almost the same as the mechanism used in + /// traditional unit testing where test data is separated out into helper methods. + /// This data provider is useful when used in conjunction with the + /// <see cref="XMLDataProvider"/> for input data types that cannot be serialized into XML + /// and therefore cannot be loaded using <see cref="XMlDataProvider"/>. + /// <para> + /// This class derives from the <c>System.Attribute</c> class. This + /// allows this class to be configured as a data provider for a test method parameter. + /// </para> + /// <para> + /// The AttributeUsage attribute for this class: + /// <c>[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)]</c> + /// ensures that this attribute can be applied at a class, method or at a parameter level. + /// </para> + /// <para> + /// When this attribute is specified at a <c>TestFixture</c> level, + /// all the test method parameters in that <c>TestFixture</c> are loaded using this data provider + /// unless, if a different data provider is specified at a test method or parameter level. + /// When this data provider is specified as an attribute on the test method, it + /// overrides any data provider configured at the test fixture level. + /// Similarly, when specified at the parameter level, this data provider is used to load that parameter, irrespective of the data providers configured at the test method or test fixture levels. + /// </para> + /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] public class CodeDataProviderAttribute : Attribute, IDataProvider { private string _dataMethodName; + + /// <summary> + /// This is an optional property that specifies the name of the helper method to be called by + /// this data provider to load input data. + /// </summary> + /// <remarks> + /// If this property is not specified, this data provider uses a + /// naming convention to identify the helper method to + /// be called. + /// <para> + /// The naming convention used is: + /// </para> + ///<code escaped="true"> + /// [testMethodName]_[parameterName]_data() + /// </code> + /// <para> + /// The helper method must be a private instance method that has the following signature: + /// </para> + /// <code escaped="true" lang="c#"> + /// private object [testMethodName]_[parameterName]_data(ParameterInfo pinfo, string methodName, string scenarioName) + /// </code> + /// </remarks> public string DataMethodName { get { return _dataMethodName; } set { _dataMethodName = value; } } + /// <summary> + /// This is the implementation of the <see cref="IDataProvider"/> interface. + /// This implementation uses reflection to invoke a helper method on an object reference to load input data + /// for a test scenario. + /// </summary> + /// <param name="pInfo">Meta information about the input parameter to be loaded.</param> + /// <param name="methodName">The name of the test method whose input parameter needs to be loaded. + /// This name is used in a naming convention to identify the helper method to be + /// called to load the input data.</param> + /// <param name="scenarioName">The name of the test scenario for which test input data needs to be loaded. + /// This name is passed to the helper method that returns input data.</param> + /// <param name="testFixture">This is the object reference that contains the helper method that returns input data. + /// Usually, this is a reference to the TestFixture itself.</param> + /// <returns>Returns the loaded input data as returned from the helper method.</returns> + /// <remarks> + /// If the <see cref="DataMethodName"/>property is not specified, this data provider uses a + /// naming convention to identify the helper method to + /// be called. + /// <para> + /// The naming convention used is: + /// </para> + ///<code escaped="true"> + /// [testMethodName]_[parameterName]_data() + /// </code> + /// <para> + /// The helper method must be a private instance method that has the following signature: + /// </para> + /// <code escaped="true" lang="c#"> + /// private object [testMethodName]_[parameterName]_data(ParameterInfo pinfo, string methodName, string scenarioName) + /// </code> + /// </remarks> public object GetData(ParameterInfo pInfo, string methodName, string scenarioName, object testFixture) { if (string.IsNullOrEmpty(DataMethodName)) 1.2 +48 -0 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/IAsserter.cs Index: IAsserter.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/IAsserter.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- IAsserter.cs 10 Jan 2007 22:56:52 -0000 1.1 +++ IAsserter.cs 19 Feb 2007 06:54:19 -0000 1.2 @@ -3,8 +3,56 @@ namespace AndroMDA.ScenarioUnit { + /// <summary> + /// This interface is implemented by all concrete Asserter classes. + /// The implementation of this interface provides the ability to assert that actual output is equal to expected output for a specific test scenario. + /// </summary> + /// <remarks> + /// The implementation of this interface receives the actual output returned + /// by invoking the system under test for a specific scenario + /// and compares this output with expected data stored outside the actual test cases (Similar to the data provider concept.) + /// <para> + /// A concrete asserter that implements this interface needs to + /// derive from the <see cref="System.Attribute"/> class so that it can + /// be configured to be used to assert output data. + /// <para> + /// The asserter should use the following<c>AttributeUsage</c> tag: + /// <para> + /// <c>[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)]</c> + /// </para> + /// This allows an asserter to be configured at a <c>TestFixture</c>, + /// <c>TestMethod</c>, or a <c>parameter</c> level, giving fine grained control to + /// the developers writing unit tests over how test output is asserted. + /// </para> + /// </para> + /// </remarks> public interface IAsserter { + /// <summary> + /// This method asserts actual output for a specific test scenario + /// with expected output. + /// The <see cref="TestScenarioHelper"/> class calls this method + /// once for each return and output paramter + /// of a test method. + /// </summary> + /// <param name="outputObj">The actual output obtained by invoking the system under test.</param> + /// <param name="pInfo">Meta information about the actual output object. + /// This information can be used by concrete IAsserter implementations to help load the expected output and perform + /// the comparison of actual output with expected output.</param> + /// <param name="methodName">This is the name of the test method being used to invoke the functionality under test. + /// This information can be used by concrete IAsserter implementations to help load the expected output and perform + /// the comparison of actual output with expected output.</param> + /// <param name="scenarioName">The name of the test scenario being executed. + /// This information can be used by concrete IAsserter implementations to help load the expected output and perform + /// the comparison of actual output with expected output.</param> + /// <param name="testFixture">A reference to the class containing the test case or any other helper methods + /// that can help in asserting the output.</param> + /// <remarks> + /// This method receives only the actual output as a parameter + /// and not the expected output because the concrete asserter + /// is required to load/find the expected output on its own using concepts similar to the data provider. + /// Meta information about the output, test method and the test scenario being executed is passed along to this method. + /// </remarks> void AssertOutput(Object outputObj, ParameterInfo pInfo, string methodName, string scenarioName, object testFixture); } } 1.2 +39 -0 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/IDataProvider.cs Index: IDataProvider.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/IDataProvider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- IDataProvider.cs 10 Jan 2007 22:56:52 -0000 1.1 +++ IDataProvider.cs 19 Feb 2007 06:54:19 -0000 1.2 @@ -5,8 +5,47 @@ namespace AndroMDA.ScenarioUnit { + /// <summary> + /// This is the interface implemented by all data providers. + /// </summary> + /// <remarks> + /// A data provider is used by the <see cref="TestScenarioHelper"/> class to load the input data for + /// a test scenario and pass it to a test method. + /// <para> + /// A data provider that implements this interface needs to + /// derive from the <see cref="System.Attribute"/> class so that it can + /// be configured to be used to read input data. + /// <para> + /// The data provider should use the following<c>AttributeUsage</c> tag: + /// <para> + /// <c>[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)]</c> + /// </para> + /// This allows a data provider to be configured at a <c>TestFixture</c>, + /// <c>TestMethod</c>, or a <c>parameter</c> level, giving fine grained control to + /// the developers writing unit tests over how test input data is provided for each test case. + /// </para> + /// </para> + /// </remarks> public interface IDataProvider { + /// <summary> + /// <c>TestScenarioHelper</c> calls this method on a concrete implementation of + /// this interface once for each input parameter for a test method. + /// </summary> + /// <param name="pInfo">This is the <c>System.Reflection.ParameterInfo</c> object that contains information about the + /// input parameter to be loaded.</param> + /// <param name="methodName">This is the name of the test method to which the loaded input parameter will be passed. + /// The XML and code-based data providers use this name as a part of of a naming convention to locate the source of input data.</param> + /// <param name="scenarioName">This is the name of the test scenario for which input data needs to be loaded. + /// The XML and code-based concrete data provider implementations use this scenario name as a part of a naming convention to locate the + /// source of input data.</param> + /// <param name="testFixture">This is a reference to an object that contains any helper methods or information that may be needed by a specific data provider. + /// For example, in case of code-based data provider, this object contains the helper method that will return the loaded input parameters.</param> + /// <returns>This method returns the loaded input test method parameter as an object.</returns> + /// <remarks> + /// This method is called by <see cref="TestScenarioHelper"/> on a concrete implementation + /// of this interface for each input parameter of a test method. + /// </remarks> object GetData(ParameterInfo pInfo, string methodName, string scenarioName, object testFixture); } } \ No newline at end of file 1.2 +70 -27 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/TestScenarioHelper.cs Index: TestScenarioHelper.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/TestScenarioHelper.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- TestScenarioHelper.cs 10 Jan 2007 22:56:52 -0000 1.1 +++ TestScenarioHelper.cs 19 Feb 2007 06:54:19 -0000 1.2 @@ -4,33 +4,75 @@ using System.Text; using System.Reflection; + +///<summary> +///This namespace contains the various classes for the AndroMDA.ScenarioUnit library. +///</summary> namespace AndroMDA.ScenarioUnit { + /// <summary> + /// This is the helper class that is used to invoke the functionality provided by the AndroMDA.ScenarioUnit framework. + /// </summary> + /// <remarks> + /// This class has a single public static method + /// <c>Invoke()</c> that is called from test cases to execute a specific test scenario. + /// <para> + /// To be able to use this testing framework, the following + /// configuration entries are required + /// in the app.config file of the test harness: + /// <code escaped="true"> + /// <runtime> + /// <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + ///<dependentAssembly> + ///<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> + ///<bindingRedirect oldVersion="2.0.6.0" newVersion="2.2.8.0" /> + ///<bindingRedirect oldVersion="2.1.4.0" newVersion="2.2.8.0" /> + ///<bindingRedirect oldVersion="2.2.0.0" newVersion="2.2.8.0" /> + /// </dependentAssembly> + ///</assemblyBinding> + ///</runtime> + /// </code> + /// </para> + /// <note> + /// The "NewVersion" value in these entries should be the value of the + /// NUnit version being used in the test harness. + /// </note> + /// <para> + /// Look at the MoneyServiceSample in the samples folder of the + /// AndroMDA.ScenarioUnit source to see examples of simple usage of this test framework. + /// </para> + /// <para> + /// To see samples of all possible combinations in which this testing framework can be used, + /// look at the test cases implemented for this framework itself + /// in the AndroMDA.ScenarioUnit.Tests project. + /// </para> + /// </remarks> public class TestScenarioHelper { + + protected TestScenarioHelper() { } + /// <summary> - /// The only public method of this class. - /// this is called from test cases and does the following. - /// Calls the method specified by the "methodName" attribute; - /// passing in all input parameters after reading them from XML files on the disk. - /// The following convention is used to determine the file name for reading in a parameter: - /// methodName_scenarioName[_parameterName].xml - /// The parameterName part is not present for files corresponding to the returned value from a method. - /// The value returned from the method call, if any, is saved in XML format to - /// a file. - /// Next, for all output parameters and return values, assertions are performed by using the expected output XML files. These files are also loaded - /// based on the naming convention specified above. - /// Before comparing the actual and expected XML files, this method performs cleanup on the - /// two XML documents and removes the nodes specified in the "rules" XML file. - /// These are nodes like generated identifiers, date time fields etc. that cannot be specified in the expected output because these are determined at run time. - /// The location of the four sets of files used in this process is specified by using the - /// TestDataInputDir, TestDataExpectedOutputDir, TestDataActualOutputDir, and TestDataRulesDir key-value - /// pairs in the configuration file of the test harness. + /// This is the method used to invoke a test method for a specific scenario. /// </summary> /// <param name="methodName">The test method to execute. This must be a private instance method /// in the TestFixture class.</param> /// <param name="scenarioName">The test scenario.</param> /// <param name="testFixture">The class containing the test method.</param> + /// <remarks> + /// this method is called from an NUnit test case and does the following: + /// <list type="bullet"> + /// <item> + /// Calls the method specified by the <c>methodName</c> parameter; + /// passing in all input parameters by using the concrete implementation of <see cref="IDataProvider"/> configured for each parameter. + /// </item> + /// <item> + /// Captures the actual output returned from the test method and + /// compares it with the expected output using the concrete implementation of <see cref="IAsserter"/> configured for each return value + /// and out/ref parameter. + /// </item> + /// </list> + /// </remarks> public static void Invoke(string methodName, string scenarioName, Object testFixture) { MethodInfo mInfo = testFixture.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.IgnoreCase); @@ -41,8 +83,8 @@ foreach (ParameterInfo pInfo in pInfos) { Object parameter = null; - //Try to load a parameter from an XML - //file only if it is an input parameter. + //Try to load a parameter + //only if it is an input parameter. //Otherwise, just add the parameterInfo for that parameter //into an array for assertion later. if (pInfo.IsOut) @@ -95,6 +137,7 @@ throw e.InnerException; } } + #region private helper methods /// <summary> /// Helper method to get the asserter to be used for a test case. 1.4 +196 -0 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLAsserterAttribute.cs Index: XMLAsserterAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLAsserterAttribute.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- XMLAsserterAttribute.cs 18 Jan 2007 10:49:48 -0000 1.3 +++ XMLAsserterAttribute.cs 19 Feb 2007 06:54:19 -0000 1.4 @@ -12,6 +12,72 @@ namespace AndroMDA.ScenarioUnit { + /// <summary> + /// This is a concrete implementation of the <see cref="IAsserter"/> interface that uses XML files to store and compare expected output + /// with actual output objects serialized into XML. + /// </summary> + /// <remarks> + /// This asserter uses XML asserts to compare actual and expected output from a test scenario. + /// Internally, it uses an open source XML-based unit testing framework called + /// NXUnit <see ref="http://www.sf.net/NXUnit"/> to perform the XML comparisons. + /// <para> + /// Similar to the <see cref="XMLDataProvider"/>, this asserter also uses the + /// XML format produced by serializing an object using the System.Xml.Serialization.XmlSerializer class. + /// This means that this asserter can be used to assert only those return/output types + /// that can be serialized into XML. + /// </para> + /// <para> + /// The <see cref="TestScenarioHelper"/> class constructs a concrete instance of this asserter + /// for each return value/output parameter that is configured to use this asserter for a test method. + /// </para> + /// <para> + /// The following 3 entries are required in the + /// test harness app.config file to use this asserter: + /// </para> + /// <para> + /// <code escaped="true"> + /// <appSettings> + /// <add key="TestDataExpectedOutputDir" value="../../testdata/expected_output"/> + ///<add key="TestDataActualOutputDir" value="../../testdata/actual_output"/> + ///<add key="TestDataRulesDir" value="../../testdata/rules"/> + ///</appSettings> + /// + /// </code> + /// </para> + /// <para> + /// These 3 entries specify the folders that store the following: + /// <list type="bullet"> + /// <item>expected output as serialized XML</item> + /// <item>actual output generated by executing a test case</item> + /// <item>XML comparison rules for ignoring the values that cannot be compared between actual and expected output, e.g. database generated IDs etc. (more details below)</item> + /// </list> + /// </para> + /// <para> + /// This asserter provides the ability to ignore parts of the output while comparing actual and expected values. + /// This is required for values that cannot be predicted and cannot be a part of the expected output, such as + /// a date time field that stores the current date/time value or an ID field that is generated in the database. + /// Rules can be created to ignore such items while asserting actual and expected outputs. These rules + /// take the form of XPath queries that specify exact nodes in the serialized XML object to be compared. + /// </para> + /// <para> + /// This class derives from the <c>System.Attribute</c> class. This + /// allows this class to be configured as the asserter for a test method return value or output parameter. + /// </para> + /// <para> + /// The AttributeUsage attribute for this class: + /// <c>[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)]</c> + /// ensures that this attribute can be applied at a class, method or at a parameter level. + /// </para> + /// <para> + /// When this attribute is specified at a <c>TestFixture</c> level, + /// all the test method return values and output parameters in that <c>TestFixture</c> are asserted using this asserter + /// unless, if a different asserter is specified at a test method or parameter level. + /// When this asserter is specified as an attribute on the test method, it + /// overrides any asserter configured at the test fixture level. + /// Similarly, when specified at the return value or output parameter level, + /// this data provider is used to assert that parameter, irrespective of the asserter configured at the test method or test fixture levels. + /// </para> + /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] public class XMLAsserterAttribute : Attribute, IAsserter @@ -21,6 +87,27 @@ private string _expectedOutputDir; private string _rulesDir; + /// <summary> + /// This property is used in conjunction with the + /// configuration entry + /// <code escaped="true"> + /// <add key="TestDataActualOutputDir" value="[somePath]"/> + /// </code> + /// <para> + /// This configuration entry specifies the directory in which all + /// actual output is dumped as serialized XML. + /// This property is used to specify a sub-directory below the TestDataActualOutputDir + /// folder. + /// </para> + /// </summary> + /// <remarks> + /// This property helps organize test output data in + /// sub-folders below the TestDataActualOutputDir folder. + /// <para> + /// This property is optional and if it is not + /// set, the methods in this class will output all actual output in the TestDataActualOutputDir folder. + /// </para> + /// </remarks> public string ActualOutputDir { get @@ -35,6 +122,27 @@ set { _actualOutputDir = value; } } + /// <summary> + /// This property is used in conjunction with the + /// configuration entry + /// <code escaped="true"> + /// <add key="TestDataExpectedOutputDir" value="[somePath]"/> + /// </code> + /// <para> + /// This configuration entry specifies the directory in which + /// expected test output is stored as serialized XML. + /// This property is used to specify a sub-directory below the TestDataExpectedOutputDir + /// folder. + /// </para> + /// </summary> + /// <remarks> + /// This property helps organize expected test output data in + /// sub-folders below the TestDataExpectedOutputDir folder. + /// <para> + /// This property is optional and if it is not + /// set, the methods in this class will look for expected test output in the TestDataExpectedOutputDir folder. + /// </para> + /// </remarks> public string ExpectedOutputDir { get @@ -49,6 +157,29 @@ set { _expectedOutputDir = value; } } + /// <summary> + /// This property is used in conjunction with the + /// configuration entry + /// <code escaped="true"> + /// <add key="TestDataRulesDir" value="[somePath]"/> + /// </code> + /// <para> + /// This configuration entry specifies the directory in which + /// XML comparison rules are stored as XPath queries. These XPath queries specify the parts of actual and expected output + /// XML files that do not need to be compared while asserting actual output against expected output. + /// This property is used to specify a sub-directory below the TestDataRulesDir + /// folder. + /// </para> + /// </summary> + /// <remarks> + /// This property helps organize test assertion rules in + /// sub-folders below the TestDataRulesDir folder. + /// <para> + /// This property is optional and if it is not + /// set, the methods in this class will look for assertion ignore rules + /// in the TestDataRulesDir folder. + /// </para> + /// </remarks> public string RulesDir { get @@ -65,6 +196,71 @@ #endregion #region interface implementation + /// <summary> + /// This method implements the <see cref="IAsserter"/> interface. + /// In this implementation, actual and expected output is serialized as XML + /// and then compared using an open source XML-based framework named NXUnit + /// <see ref="http://www.sf.net/NXUnit"/>. + /// </summary> + /// <param name="outputObj">The actual output returned from the system under test.</param> + /// <param name="pInfo">Meta information about the <paramref name="outputObj"/> object.</param> + /// <param name="methodName">The name of the test method. + /// This name is used as a part of file naming convention used to name actual output, expected output and rules XML files.</param> + /// <param name="scenarioName"> + /// The name of the test scenario. + /// This name is used as a part of file naming convention used to name actual output, expected output and rules XML files. + /// </param> + /// <param name="testFixture">This parameter is not used by this asserter.</param> + /// <remarks> + /// This method is called by the <see cref="TestScenarioHelper"/> class once for + /// every return value/output parameter of a test method for which + /// this asserter is configured. + /// <para> + /// This method serializes the actual test output returned from the + /// system under test using the System.Xml.Serialization.XmlSerializer class. + /// </para> + /// <para> + /// This method also saves the actual output to a physical file, so that it + /// can be reviewed manually after the test case is run. This file is created in the folder + /// specified by the <see cref="ActualOutputDir"/> property. + /// </para> + /// <para> + /// The name of the physical file is created using the same naming convention as that used + /// by the <see cref="XMLDataProvider"/> class: methodName_scenarioName_parameterName.xml. + /// <note> + /// In case of return parameters, there is no "parameterName", so, the file name is just methodName_scenarioName.xml. + /// </note> + /// </para> + /// <para> + /// This method reads expected output from XML files from the location + /// specified by the <see cref="ExpectedOutputDir"/> property. + /// </para> + /// <para> + /// The file naming convention used to identify the file to be read is the same here as well: + /// methodName_scenarioName_parameterName.xml. + /// </para> + /// <para> + /// Not all values in actual and expected output can be compared + /// in some situations. + /// </para> + /// <para> + /// For example, the output may contain a generated ID from the database + /// or a dateTime field that is filled with the current + /// date time value by the system under test. + /// </para> + /// <para> + /// Such parts that cannot be compared need to be ignored while + /// asserting the actual output against expected output. This can be done by creating a rules + /// file for the specific return value/output parameter for each test scenario. + /// </para> + /// <para> + /// This rules file takes the form of an XML file + /// with XPath queries identifying the nodes in the actual and expected + /// output XML files that need to be ignored. This rules file also + /// follows the same naming convention of methodName_scenarioName_parameterName.xml + /// and is placed in the directory specified by the <see cref="RulesDir"/> property. + /// </para> + /// </remarks> public void AssertOutput(Object outputObj, ParameterInfo pInfo, string methodName, string scenarioName, object testFixture) { SaveOutput(outputObj, pInfo, methodName, scenarioName); 1.3 +134 -0 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLDataProviderAttribute.cs Index: XMLDataProviderAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLDataProviderAttribute.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- XMLDataProviderAttribute.cs 18 Jan 2007 10:49:48 -0000 1.2 +++ XMLDataProviderAttribute.cs 19 Feb 2007 06:54:19 -0000 1.3 @@ -10,6 +10,42 @@ namespace AndroMDA.ScenarioUnit { + /// <summary> + /// This is a concrete implementation of the <see cref="IDataProvider"/> interface. + /// This data provider loads input data stored as serialized XML objects in files. + /// </summary> + /// <remarks> + /// To use this data provider, the following configuration entry is required in the configuration file of the test harness: + /// <para> + /// <code escaped="true"> + /// <add key="TestDataInputDir" value="[somePath]" /> + /// </code> + /// </para> + /// <para> + /// This entry specifies the path where all the input + /// XML files are located. + /// <note> + /// A path relative to the test harness assembly binary (usually located in testHarness/bin/debug) can be specified for this configuration entry. + /// </note> + /// </para> + /// <para> + /// This class derives from the <c>System.Attribute</c> class. This + /// allows this class to be configured as a data provider for a test method parameter. + /// </para> + /// <para> + /// The AttributeUsage attribute for this class: + /// <c>[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)]</c> + /// ensures that this attribute can be applied at a class, method or at a parameter level. + /// </para> + /// <para> + /// When this attribute is specified at a <c>TestFixture</c> level, + /// all the test method parameters in that <c>TestFixture</c> are loaded using this data provider + /// unless, if a different data provider is specified at a test method or parameter level. + /// When this data provider is specified as an attribute on the test method, it + /// overrides any data provider configured at the test fixture level. + /// Similarly, when specified at the parameter level, this data provider is used to load that parameter, irrespective of the data providers configured at the test method or test fixture levels. + /// </para> + /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] public class XMLDataProviderAttribute : Attribute, IDataProvider @@ -17,6 +53,24 @@ #region member variables and properties. private string _inputDir; + /// <summary> + /// This property is used in conjunction with the + /// configuration entry + /// <code escaped="true"> + /// <add key="TestDataInputDir" value="[some path]"> + /// </code> + /// This configuration entry specifies the directory that contains all input data XML files. + /// This property is used to specify a sub-directory below the TestDataInputDir + /// folder that will be used to load the input data. + /// </summary> + /// <remarks> + /// This property helps organize test input data in + /// sub-folders below the TestDataInputDir folder. + /// <para> + /// This property is optional and if it is not + /// set, the methods in this class will look for test input XML files in the TestDataInputDir folder. + /// </para> + /// </remarks> public string InputDir { get @@ -33,6 +87,86 @@ #endregion #region public methods + /// <summary> + /// This is the concrete implementation of the + /// <see cref="IDataProvider"/> interface. + /// This method loads an input parameter for a test method for a specific scenario from an XML file. + /// </summary> + /// <param name="pInfo">This is the <c>System.Reflection.ParameterInfo</c> object that contains information about the + /// input parameter to be loaded.</param> + /// <param name="methodName">This is the name of the test method to which the loaded input parameter will be passed. + /// This data provider uses this methodName value as a part of a naming convention to locate the XML file that contains input data. + /// The input XML file is named using the convention [methodName_scenarioName_parameterName.xml] </param> + /// <param name="scenarioName">This is the name of the test scenario for which input data needs to be loaded. + /// This data provider uses the scenarioName value as a part of a naming convention to locate the XML file that contains input data. + /// The input XML file is named using the convention [methodName_scenarioName_parameterName.xml] </param> + /// <param name="testFixture">This parameter is not currently used by this data provider. </param> + /// <returns>This method returns the loaded input test method parameter as an object.</returns> + /// <remarks> + /// The input data is stored as serialized XML for the object to be loaded. + /// The XML schema used is the one generated by serializing the object using <c>System.Xml.Serialization.XmlSerializer</c>. + /// This method uses a convention to locate the XML file to be read to load and return the object. + /// <para> + /// The XML file name is constructed using the three parameters <paramref name="pInfo"/>, <paramref name="methodName"/>, and <paramref name="scenarioName"/>. + /// The file name is assumed to be : + /// <para> + /// methodName_scenarioName_parameterName.xml + /// </para> + /// For example, to load the input parameters for the test method <c>private Money Add(Money m1, Money m2)</c> + /// for the following invokation: <c>TestScenarioHelper.Invoke("Add", "SimpleAdd", this)</c> + /// this method will look for the files Add_SimpleAdd_m1.xml and + /// Add_SimpleAdd_m2.xml in the <see cref="XMLDataProvider.InputDir"/> directory. + /// </para> + /// <note> + /// you can use code similar to the following to generate the first XML file for an object and then copy it + /// over and over for multiple scenarios replacing specific values according to the input scenario. + /// <para> + /// <code lang="c#"> + /// Money m1 = new Money(1, "USD"); + /// XMLSerializer xs = new XMLSerializer(typeof(Money)); + /// using (StreamWriter sw = new StreamWriter(File.OpenWrite("Add_SimpleAdd_m1.xml"))) + /// { + /// xs.Serialize(sw, m1); + /// } + /// </code> + /// </para> + /// </note> + /// <note> + /// While trying to read polymorphic objects, + /// i.e. trying to read a derived object while the input parameter is of the base type, + /// make sure that the base type definition has an <c>[XMLInclude()]</c> attribute refering to the derived type. + /// </note> + /// </remarks> + /// <example> + /// This example shows the serialized form of the following Money class: + /// <code lang="c#"> + /// + /// namespace MoneyServiceSample + ///{ + /// public class Money + /// { + /// public int amount; + /// public string currency; + /// public Money() { } + /// + /// public Money(int amt, string crncy) + /// { + /// amount = amt; + /// currency = crncy; + /// } + /// } + ///} + /// + /// </code> + /// The following is the Add_SimpleAdd_m1.xml file: + /// <code escaped="true"> + /// <?xml version="1.0" encoding="utf-8"?> + ///<Money xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + /// <amount>12</amount> + /// <currency>CHF</currency> + ///</Money> + /// </code> + /// </example> public object GetData(ParameterInfo pInfo, string methodName, string scenarioName, object testFixture) { string inputFileName = GetFileName(pInfo, methodName, scenarioName); |