diff options
author | Lluis Sanchez <lluis@novell.com> | 2010-05-21 16:00:44 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2010-05-21 16:00:44 +0400 |
commit | 0c4f27c01c3ec1a656a425d2502390f2400acb73 (patch) | |
tree | 057ba07695453926b70c633c6f824ecd8d7aefd6 | |
parent | f7f30141351477f14b3e3f25c4ce92e4ea0d5033 (diff) |
* Test/MultiAssemblyAddin:
* Test/UnitTests/Makefile.am:
* Test/UnitTests/UnitTests.csproj:
* Test/UnitTests/TestExtensions.cs:
* Test/MultiAssemblyAddin/Extensions.cs:
* Test/MultiAssemblyAddin/SecondAssembly:
* Test/MultiAssemblyAddin/OptionalModule:
* Test/FileExtender/FileExtender.Bis.addin.xml:
* Test/MultiAssemblyAddin/MultiAssemblyAddin.csproj:
* Test/MultiAssemblyAddin/OptionalModule/Extensions.cs:
* Test/MultiAssemblyAddin/SecondAssembly/Extensions.cs:
* Test/UnitTests/ExtensionModel/AttrExtensionWithManyNodes.cs:
* Test/MultiAssemblyAddin/OptionalModule/OptionalModule.csproj:
* Test/MultiAssemblyAddin/SecondAssembly/SecondAssembly.csproj:
* Test/UnitTests/ExtensionModel/MultiAssemblyTestExtensionPoint.cs:
Added new tests.
* Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs: When resolving
extension from an optional module, include dependencies defined in
the main module.
* Mono.Addins/Mono.Addins.Database/SetupDomain.cs: Flush.
* Mono.Addins/Mono.Addins.Database/AddinScanner.cs: Look for assembly
imports in the main assembly.
svn path=/trunk/mono-addins/; revision=157677
22 files changed, 289 insertions, 3 deletions
diff --git a/Mono.Addins/ChangeLog b/Mono.Addins/ChangeLog index 1e76484..b331267 100644 --- a/Mono.Addins/ChangeLog +++ b/Mono.Addins/ChangeLog @@ -1,5 +1,16 @@ 2010-05-21 Lluis Sanchez Gual <lluis@novell.com> + * Mono.Addins.Database/AddinUpdateData.cs: When resolving + extension from an optional module, include dependencies + defined in the main module. + + * Mono.Addins.Database/SetupDomain.cs: Flush. + + * Mono.Addins.Database/AddinScanner.cs: Look for assembly + imports in the main assembly. + +2010-05-21 Lluis Sanchez Gual <lluis@novell.com> + * Mono.Addins/ExtensionNode.cs: * Mono.Addins/ExtensionTree.cs: Data extension points bound to an attribute now generate nodes of type diff --git a/Mono.Addins/Mono.Addins.Database/AddinScanner.cs b/Mono.Addins/Mono.Addins.Database/AddinScanner.cs index a66f398..372e0d8 100644 --- a/Mono.Addins/Mono.Addins.Database/AddinScanner.cs +++ b/Mono.Addins/Mono.Addins.Database/AddinScanner.cs @@ -603,6 +603,7 @@ namespace Mono.Addins.Database if (rootAssembly != null) { ScanAssemblyAddinHeaders (config, rootAssembly, scanResult); + ScanAssemblyImports (config.MainModule, rootAssembly); assemblies.Add (rootAssembly); rootAsmFile = Path.GetFileName (config.AddinFile); } diff --git a/Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs b/Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs index ce4272d..5c4ab48 100644 --- a/Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs +++ b/Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs @@ -252,8 +252,17 @@ namespace Mono.Addins.Database string addinId = Addin.GetFullId (installedDescription.Namespace, installedDescription.LocalId, null); string requiredVersion = null; - for (int n = module.Dependencies.Count - 1; n >= 0; n--) { - AddinDependency adep = module.Dependencies [n] as AddinDependency; + IEnumerable deps; + if (module == description.MainModule) + deps = module.Dependencies; + else { + ArrayList list = new ArrayList (); + list.AddRange (module.Dependencies); + list.AddRange (description.MainModule.Dependencies); + deps = list; + } + foreach (object dep in deps) { + AddinDependency adep = dep as AddinDependency; if (adep != null && Addin.GetFullId (description.Namespace, adep.AddinId, null) == addinId) { requiredVersion = adep.Version; break; diff --git a/Mono.Addins/Mono.Addins.Database/SetupDomain.cs b/Mono.Addins/Mono.Addins.Database/SetupDomain.cs index b697bbf..bb2aa82 100644 --- a/Mono.Addins/Mono.Addins.Database/SetupDomain.cs +++ b/Mono.Addins/Mono.Addins.Database/SetupDomain.cs @@ -1,4 +1,4 @@ -// http://bugzilla.novell.com/enter_bug.cgi?alias=&assigned_to=&blocked=&bug_file_loc=http%3A%2F%2F&bug_severity=Normal&bug_status=NEW&cf_foundby=---&cf_nts_priority=&cf_nts_support_num=&cf_partnerid=&comment=Description%20of%20Problem%3A%0D%0A%0D%0A%0D%0ASteps%20to%20reproduce%20the%20problem%3A%0D%0A1.%20%0D%0A2.%20%0D%0A%0D%0A%0D%0AActual%20Results%3A%0D%0A%0D%0A%0D%0AExpected%20Results%3A%0D%0A%0D%0A%0D%0AHow%20often%20does%20this%20happen%3F%20%0D%0A%0D%0A%0D%0AAdditional%20Information%3A%0D%0A%0D%0A%0D%0A&component=&contenttypeentry=&contenttypemethod=autodetect&contenttypeselection=text%2Fplain&data=&deadline=&dependson=&description=&estimated_time=0.0&flag_type-2=X&form_name=enter_bug&keywords=&maketemplate=Remember%20values%20as%20bookmarkable%20template&op_sys=Other&priority=P5%20-%20None&product=MonoDevelop%20&qa_contact=&rep_platform=Other&short_desc=&version=unspecified +// // SetupDomain.cs // // Author: diff --git a/Test/ChangeLog b/Test/ChangeLog index 2808966..e03e57d 100644 --- a/Test/ChangeLog +++ b/Test/ChangeLog @@ -1,3 +1,7 @@ +2010-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MultiAssemblyAddin: Added new tests. + 2008-11-10 Lluis Sanchez Gual <lluis@novell.com> * UnitTests/Makefile.am: diff --git a/Test/FileExtender/ChangeLog b/Test/FileExtender/ChangeLog index 71115cd..53f18df 100644 --- a/Test/FileExtender/ChangeLog +++ b/Test/FileExtender/ChangeLog @@ -1,3 +1,7 @@ +2010-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * FileExtender.Bis.addin.xml: Added new tests. + 2010-03-29 Lluis Sanchez Gual <lluis@novell.com> * FileExtender.csproj: Remove import. diff --git a/Test/FileExtender/FileExtender.Bis.addin.xml b/Test/FileExtender/FileExtender.Bis.addin.xml index 28ad9c8..7eabf63 100644 --- a/Test/FileExtender/FileExtender.Bis.addin.xml +++ b/Test/FileExtender/FileExtender.Bis.addin.xml @@ -10,4 +10,9 @@ </Condition> </Extension> + <Extension path = "/SimpleApp/AttrExtensionWithManyNodes"> + <Node /> + <ExtraNode /> + </Extension> + </ExtensionModel> diff --git a/Test/MultiAssemblyAddin/ChangeLog b/Test/MultiAssemblyAddin/ChangeLog new file mode 100644 index 0000000..d6a63f3 --- /dev/null +++ b/Test/MultiAssemblyAddin/ChangeLog @@ -0,0 +1,7 @@ +2010-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * Extensions.cs: + * SecondAssembly: + * OptionalModule: + * MultiAssemblyAddin.csproj: Added new tests. + diff --git a/Test/MultiAssemblyAddin/Extensions.cs b/Test/MultiAssemblyAddin/Extensions.cs new file mode 100644 index 0000000..eb890af --- /dev/null +++ b/Test/MultiAssemblyAddin/Extensions.cs @@ -0,0 +1,39 @@ +// +// MyClass.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2010 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using UnitTests; +using Mono.Addins; + +[assembly:Addin] +[assembly:AddinDependency ("SimpleApp.Core", "0.1.0")] + +[assembly:MultiAssemblyTestExtensionPoint ("main1")] +[assembly:MultiAssemblyTestExtensionPoint ("main2")] + +[assembly:ImportAddinAssembly ("SecondAssembly.dll")] + +[assembly:AddinModule ("OptionalModule.dll")] diff --git a/Test/MultiAssemblyAddin/MultiAssemblyAddin.csproj b/Test/MultiAssemblyAddin/MultiAssemblyAddin.csproj new file mode 100644 index 0000000..9f8ad03 --- /dev/null +++ b/Test/MultiAssemblyAddin/MultiAssemblyAddin.csproj @@ -0,0 +1 @@ +<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8C374D09-E916-4C6C-A01B-43A06A0D0499}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>MultiAssemblyAddin</RootNamespace>
<AssemblyName>MultiAssemblyAddin</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\lib</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\lib</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Extensions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Mono.Addins\Mono.Addins.csproj">
<Project>{91DD5A2D-9FE3-4C3C-9253-876141874DAD}</Project>
<Name>Mono.Addins</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\UnitTests\UnitTests.csproj">
<Project>{1CD51E61-1985-4D22-9BFA-D14C8FC61B46}</Project>
<Name>UnitTests</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties InternalTargetFrameworkVersion="3.5" xmlns="" />
</MonoDevelop>
</ProjectExtensions>
</Project>
\ No newline at end of file diff --git a/Test/MultiAssemblyAddin/OptionalModule/ChangeLog b/Test/MultiAssemblyAddin/OptionalModule/ChangeLog new file mode 100644 index 0000000..152a130 --- /dev/null +++ b/Test/MultiAssemblyAddin/OptionalModule/ChangeLog @@ -0,0 +1,5 @@ +2010-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * Extensions.cs: + * OptionalModule.csproj: Added new tests. + diff --git a/Test/MultiAssemblyAddin/OptionalModule/Extensions.cs b/Test/MultiAssemblyAddin/OptionalModule/Extensions.cs new file mode 100644 index 0000000..383b904 --- /dev/null +++ b/Test/MultiAssemblyAddin/OptionalModule/Extensions.cs @@ -0,0 +1,34 @@ +// +// MyClass.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2010 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using UnitTests; +using Mono.Addins; + +[assembly:AddinDependency ("SimpleApp.HelloWorldExtension", "0.1.0")] + +[assembly:MultiAssemblyTestExtensionPoint ("optional1")] +[assembly:MultiAssemblyTestExtensionPoint ("optional2")] diff --git a/Test/MultiAssemblyAddin/OptionalModule/OptionalModule.csproj b/Test/MultiAssemblyAddin/OptionalModule/OptionalModule.csproj new file mode 100644 index 0000000..625f9ef --- /dev/null +++ b/Test/MultiAssemblyAddin/OptionalModule/OptionalModule.csproj @@ -0,0 +1 @@ +<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B051C84E-48CC-448D-B00C-1525EB64E4BE}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>OptionalModule</RootNamespace>
<AssemblyName>OptionalModule</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\lib</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\lib</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Mono.Addins\Mono.Addins.csproj">
<Project>{91DD5A2D-9FE3-4C3C-9253-876141874DAD}</Project>
<Name>Mono.Addins</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\UnitTests\UnitTests.csproj">
<Project>{1CD51E61-1985-4D22-9BFA-D14C8FC61B46}</Project>
<Name>UnitTests</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Extensions.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties InternalTargetFrameworkVersion="3.5" xmlns="" />
</MonoDevelop>
</ProjectExtensions>
</Project>
\ No newline at end of file diff --git a/Test/MultiAssemblyAddin/SecondAssembly/ChangeLog b/Test/MultiAssemblyAddin/SecondAssembly/ChangeLog new file mode 100644 index 0000000..db18899 --- /dev/null +++ b/Test/MultiAssemblyAddin/SecondAssembly/ChangeLog @@ -0,0 +1,5 @@ +2010-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * Extensions.cs: + * SecondAssembly.csproj: Added new tests. + diff --git a/Test/MultiAssemblyAddin/SecondAssembly/Extensions.cs b/Test/MultiAssemblyAddin/SecondAssembly/Extensions.cs new file mode 100644 index 0000000..e749789 --- /dev/null +++ b/Test/MultiAssemblyAddin/SecondAssembly/Extensions.cs @@ -0,0 +1,31 @@ +// +// MyClass.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2010 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using UnitTests; + +[assembly:MultiAssemblyTestExtensionPoint ("extra1")] +[assembly:MultiAssemblyTestExtensionPoint ("extra2")] diff --git a/Test/MultiAssemblyAddin/SecondAssembly/SecondAssembly.csproj b/Test/MultiAssemblyAddin/SecondAssembly/SecondAssembly.csproj new file mode 100644 index 0000000..d99d37c --- /dev/null +++ b/Test/MultiAssemblyAddin/SecondAssembly/SecondAssembly.csproj @@ -0,0 +1 @@ +<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{EB38A832-1BA5-4073-910C-7ACC5F1D1AD4}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>SecondAssembly</RootNamespace>
<AssemblyName>SecondAssembly</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\lib</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\lib</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Mono.Addins\Mono.Addins.csproj">
<Project>{91DD5A2D-9FE3-4C3C-9253-876141874DAD}</Project>
<Name>Mono.Addins</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\UnitTests\UnitTests.csproj">
<Project>{1CD51E61-1985-4D22-9BFA-D14C8FC61B46}</Project>
<Name>UnitTests</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Extensions.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties InternalTargetFrameworkVersion="3.5" xmlns="" />
</MonoDevelop>
</ProjectExtensions>
</Project>
\ No newline at end of file diff --git a/Test/UnitTests/ChangeLog b/Test/UnitTests/ChangeLog index d283599..e43370e 100644 --- a/Test/UnitTests/ChangeLog +++ b/Test/UnitTests/ChangeLog @@ -1,5 +1,14 @@ 2010-05-21 Lluis Sanchez Gual <lluis@novell.com> + * Makefile.am: + * UnitTests.csproj: + * TestExtensions.cs: + * ExtensionModel/AttrExtensionWithManyNodes.cs: + * ExtensionModel/MultiAssemblyTestExtensionPoint.cs: Added new + tests. + +2010-05-21 Lluis Sanchez Gual <lluis@novell.com> + * IWriter.cs: * Makefile.am: * TestEvents.cs: diff --git a/Test/UnitTests/ExtensionModel/AttrExtensionWithManyNodes.cs b/Test/UnitTests/ExtensionModel/AttrExtensionWithManyNodes.cs new file mode 100644 index 0000000..3e2eb47 --- /dev/null +++ b/Test/UnitTests/ExtensionModel/AttrExtensionWithManyNodes.cs @@ -0,0 +1,45 @@ +// +// AttrExtensionWithManyNodes.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2010 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using Mono.Addins; + +[assembly:ExtensionPoint ("/SimpleApp/AttrExtensionWithManyNodes", NodeType=typeof(UnitTests.AttrExtensionWithManyNodesExtensionNode))] +[assembly:ExtensionPoint ("/SimpleApp/AttrExtensionWithManyNodes", NodeName="ExtraNode", NodeType=typeof(UnitTests.AttrExtensionWithManyNodesExtensionNodeExtra))] + +namespace UnitTests +{ + [ExtensionNode ("Node")] + public class AttrExtensionWithManyNodesExtensionNode: ExtensionNode + { + } + + [ExtensionNode ("Node")] + public class AttrExtensionWithManyNodesExtensionNodeExtra: ExtensionNode + { + } +} + diff --git a/Test/UnitTests/ExtensionModel/MultiAssemblyTestExtensionPoint.cs b/Test/UnitTests/ExtensionModel/MultiAssemblyTestExtensionPoint.cs new file mode 100644 index 0000000..6b457f2 --- /dev/null +++ b/Test/UnitTests/ExtensionModel/MultiAssemblyTestExtensionPoint.cs @@ -0,0 +1,51 @@ +// +// IMultiAssemblyTestExtensionPoint.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2010 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using Mono.Addins; + +[assembly:ExtensionPoint ("/SimpleApp/MultiAssemblyTestExtensionPoint", ExtensionAttributeType=typeof(UnitTests.MultiAssemblyTestExtensionPointAttribute))] + +namespace UnitTests +{ + [AttributeUsage (AttributeTargets.Assembly, AllowMultiple=true)] + + public class MultiAssemblyTestExtensionPointAttribute: CustomExtensionAttribute + { + public MultiAssemblyTestExtensionPointAttribute () + { + } + + public MultiAssemblyTestExtensionPointAttribute (string name) + { + Name = name; + } + + [NodeAttribute ("name")] + public string Name { get; set; } + } +} + diff --git a/Test/UnitTests/Makefile.am b/Test/UnitTests/Makefile.am index ff92dcc..17f0021 100644 --- a/Test/UnitTests/Makefile.am +++ b/Test/UnitTests/Makefile.am @@ -16,11 +16,13 @@ endif FILES = \ AddinInformationTests.cs \ + ExtensionModel/AttrExtensionWithManyNodes.cs \ ExtensionModel/ComplexNode.cs \ ExtensionModel/GlobalInfoCondition.cs \ ExtensionModel/ISampleExtender.cs \ ExtensionModel/IWriter.cs \ ExtensionModel/IWriterWithMetadata.cs \ + ExtensionModel/MultiAssemblyTestExtensionPoint.cs \ ExtensionModel/NodeWithAttribute.cs \ ExtensionModel/ParameterInfoCondition.cs \ ExtensionModel/SimpleExtensionAttribute.cs \ diff --git a/Test/UnitTests/TestExtensions.cs b/Test/UnitTests/TestExtensions.cs index 0f97921..b980487 100644 --- a/Test/UnitTests/TestExtensions.cs +++ b/Test/UnitTests/TestExtensions.cs @@ -180,5 +180,21 @@ namespace UnitTests Assert.AreEqual ("test4", n2.Data.Name, "t1"); Assert.AreEqual (false, n2.Data.Value, "t2"); } + + [Test()] + public void TestAttrExtensionWithManyNodes () + { + ExtensionNodeList nodes = AddinManager.GetExtensionNodes ("/SimpleApp/AttrExtensionWithManyNodes"); + Assert.AreEqual (2, nodes.Count, "Node count"); + Assert.IsTrue (nodes [0] is AttrExtensionWithManyNodesExtensionNode); + Assert.IsNotNull (nodes [1] is AttrExtensionWithManyNodesExtensionNodeExtra); + } + + [Test()] + public void TestMultiAssemblyAddin () + { + ExtensionNodeList nodes = AddinManager.GetExtensionNodes ("/SimpleApp/MultiAssemblyTestExtensionPoint"); + Assert.AreEqual (6, nodes.Count, "Node count"); + } } } diff --git a/Test/UnitTests/UnitTests.csproj b/Test/UnitTests/UnitTests.csproj index 731ef33..07186ef 100644 --- a/Test/UnitTests/UnitTests.csproj +++ b/Test/UnitTests/UnitTests.csproj @@ -61,6 +61,8 @@ <Compile Include="ExtensionModel\NodeWithAttribute.cs" /> <Compile Include="ExtensionModel\ParameterInfoCondition.cs" /> <Compile Include="ExtensionModel\SimpleExtensionAttribute.cs" /> + <Compile Include="ExtensionModel\AttrExtensionWithManyNodes.cs" /> + <Compile Include="ExtensionModel\MultiAssemblyTestExtensionPoint.cs" /> </ItemGroup> <ItemGroup> <Content Include="SimpleApp.addin.xml"> @@ -77,6 +79,9 @@ <ProjectExtensions> <MonoDevelop> <Properties> + <Policies> + <DotNetNamingPolicy DirectoryNamespaceAssociation="None" ResourceNamePolicy="FileName" /> + </Policies> <Deployment.LinuxDeployData scriptName="unittests" generatePcFile="false" /> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="true" RelativeConfigureInPath="../../"> <BuildFilesVar Sync="true" Name="FILES" /> |