diff --git a/src/etc/testcases/taskdefs/optional/dotnet.xml b/src/etc/testcases/taskdefs/optional/dotnet.xml new file mode 100644 index 000000000..45613c131 --- /dev/null +++ b/src/etc/testcases/taskdefs/optional/dotnet.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + ilasm.found=${ilasm.found} + + + + + + + + csc.found=${csc.found} + + + + + + + + + dotnetapps.found=${dotnetapps.found} + + + + + Needed .net apps are missing + + + + + + + + + + + + + + + + + + No app ${testCSC.exe}created + + + + + + + + + + No app ${testCSC.exe}created + + + + + + + + + + + + + + + + ${ilasm.string} + + + diff --git a/src/etc/testcases/taskdefs/optional/dotnet/HelloWorld.wsdl b/src/etc/testcases/taskdefs/optional/dotnet/HelloWorld.wsdl new file mode 100644 index 000000000..c776e54c0 --- /dev/null +++ b/src/etc/testcases/taskdefs/optional/dotnet/HelloWorld.wsdl @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/etc/testcases/taskdefs/optional/dotnet/example.cs b/src/etc/testcases/taskdefs/optional/dotnet/example.cs new file mode 100644 index 000000000..4e4f4229f --- /dev/null +++ b/src/etc/testcases/taskdefs/optional/dotnet/example.cs @@ -0,0 +1,62 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "Ant" and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +using System; + +public class Example { + + public static void Main(String[] args) { + Console.WriteLine("hello, I look like Java, but I'm really .NET"); + } +} diff --git a/src/etc/testcases/taskdefs/optional/dotnet/example.il b/src/etc/testcases/taskdefs/optional/dotnet/example.il new file mode 100644 index 000000000..5a0ac744a --- /dev/null +++ b/src/etc/testcases/taskdefs/optional/dotnet/example.il @@ -0,0 +1,78 @@ +//created from ildasm of example.cs + + + +.assembly extern /*23000001*/ mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 1:0:3300:0 +} +.assembly /*20000001*/ example +{ + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom /*0C000001:0A000001*/ instance void [mscorlib/* 23000001 */]System.Diagnostics.DebuggableAttribute/* 01000002 */::.ctor(bool, + // bool) /* 0A000001 */ = ( 01 00 00 01 00 00 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module example.exe +// MVID: {641E4709-F7B6-4BB0-BC5D-49C2CF1F1CF8} +.imagebase 0x00400000 +.subsystem 0x00000003 +.file alignment 512 +.corflags 0x00000001 +// Image base: 0x03180000 +// +// ============== CLASS STRUCTURE DECLARATION ================== +// +.class /*02000002*/ public auto ansi beforefieldinit Example + extends [mscorlib/* 23000001 */]System.Object/* 01000001 */ +{ +} // end of class Example + + +// ============================================================= + + +// =============== GLOBAL FIELDS AND METHODS =================== + + +// ============================================================= + + +// =============== CLASS MEMBERS DECLARATION =================== +// note that class flags, 'extends' and 'implements' clauses +// are provided here for information only + +.class /*02000002*/ public auto ansi beforefieldinit Example + extends [mscorlib/* 23000001 */]System.Object/* 01000001 */ +{ + .method /*06000001*/ public hidebysig static + void Main(string[] args) cil managed + // SIG: 00 01 01 1D 0E + { + .entrypoint + // Method begins at RVA 0x2050 + // Code size 11 (0xb) + .maxstack 1 + IL_0000: /* 72 | (70)000001 */ ldstr "hello, I look like Java, but I'm really .NET" /* 70000001 */ + IL_0005: /* 28 | (0A)000002 */ call void [mscorlib/* 23000001 */]System.Console/* 01000003 */::WriteLine(string) /* 0A000002 */ + IL_000a: /* 2A | */ ret + } // end of method Example::Main + + .method /*06000002*/ public hidebysig specialname rtspecialname + instance void .ctor() cil managed + // SIG: 20 00 01 + { + // Method begins at RVA 0x2068 + // Code size 7 (0x7) + .maxstack 1 + IL_0000: /* 02 | */ ldarg.0 + IL_0001: /* 28 | (0A)000003 */ call instance void [mscorlib/* 23000001 */]System.Object/* 01000001 */::.ctor() /* 0A000003 */ + IL_0006: /* 2A | */ ret + } // end of method Example::.ctor + +} // end of class Example + + + diff --git a/src/etc/testcases/taskdefs/optional/dotnet/example2.il b/src/etc/testcases/taskdefs/optional/dotnet/example2.il new file mode 100644 index 000000000..1649ff6de --- /dev/null +++ b/src/etc/testcases/taskdefs/optional/dotnet/example2.il @@ -0,0 +1,52 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 1.0.3705.0 +// Copyright (C) Microsoft Corporation 1998-2001. All rights reserved. + + +// Image base: 0x03180000 +// +// ============== CLASS STRUCTURE DECLARATION ================== +// +.class public auto ansi beforefieldinit Example2 + extends [mscorlib]System.Object +{ +} // end of class Example2 + + +// ============================================================= + + +// =============== GLOBAL FIELDS AND METHODS =================== + + +// ============================================================= + + +// =============== CLASS MEMBERS DECLARATION =================== +// note that class flags, 'extends' and 'implements' clauses +// are provided here for information only + +.class public auto ansi beforefieldinit Example2 + extends [mscorlib]System.Object +{ + .field public int32 some_variable + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 14 (0xe) + .maxstack 2 + IL_0000: ldarg.0 + IL_0001: ldc.i4.3 + IL_0002: stfld int32 Example2::some_variable + IL_0007: ldarg.0 + IL_0008: call instance void [mscorlib]System.Object::.ctor() + IL_000d: ret + } // end of method Example2::.ctor + +} // end of class Example2 + + +// ============================================================= + +//*********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file example2.res diff --git a/src/testcases/org/apache/tools/ant/taskdefs/optional/DotnetTest.java b/src/testcases/org/apache/tools/ant/taskdefs/optional/DotnetTest.java new file mode 100644 index 000000000..3a739d8c8 --- /dev/null +++ b/src/testcases/org/apache/tools/ant/taskdefs/optional/DotnetTest.java @@ -0,0 +1,115 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "Ant" and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ +package org.apache.tools.ant.taskdefs.optional; + +import java.io.*; +import java.util.Properties; + +import org.apache.tools.ant.BuildFileTest; + +/** + * Tests the Dotnet tasks, based off WsdlToDotnetTest + * + * @author steve loughran + * @since Ant 1.6 + */ +public class DotnetTest extends BuildFileTest { + + /** + * Description of the Field + */ + private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/"; + + + /** + * Constructor + * + * @param name testname + */ + public DotnetTest(String name) { + super(name); + } + + + /** + * The JUnit setup method + */ + public void setUp() { + configureProject(TASKDEFS_DIR + "dotnet.xml"); + } + + + /** + * The teardown method for JUnit + */ + public void tearDown() { + executeTarget("teardown"); + } + + + /** + * A unit test for JUnit + */ + public void testCSC() throws Exception { + executeTarget("testCSC"); + } + /** + * A unit test for JUnit + */ + public void testILASM() throws Exception { + executeTarget("testILASM"); + } + +} +