Merge pull request #1304 from slluis/mac-proxy-autoconfig
[mono.git] / mcs / class / System.Data.OracleClient / Test / System.Data.OracleClient.jvm / OracleDataAdapter / OracleDataAdapter_FillSchema_DsSt.cs
1 // 
2 // Copyright (c) 2006 Mainsoft Co.
3 // 
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
11 // 
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 // 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 //
23
24 using System;
25 using System.Text;
26 using System.Data;
27 using System.Data.OracleClient;
28
29 using MonoTests.System.Data.Utils;
30
31
32 using NUnit.Framework;
33 namespace MonoTests.System.Data.OracleClient
34 {
35 [TestFixture]
36 public class OracleDataAdapter_FillSchema_DsSt : ADONetTesterClass
37 {
38         private Exception exp;
39         private string connectionString;
40
41         public static void Main()
42         {
43                 OracleDataAdapter_FillSchema_DsSt tc = new OracleDataAdapter_FillSchema_DsSt();
44                 Exception l_exp = null;
45                 try {
46                         tc.SetUp ();
47                         // Every Test must begin with BeginTest
48                         tc.BeginTest("OracleDataAdapter_FillSchema_DsSt");
49                         tc.run();
50                 } catch(Exception ex) {
51                         l_exp = ex;
52                 } finally {
53                         // Every Test must End with EndTest
54                         tc.EndTest(l_exp);
55                 }
56         }
57
58         [SetUp]
59         public void SetUp ()
60         {
61                 connectionString = ConnectedDataProvider.ConnectionString;
62         }
63
64         public void run()
65         {
66                 TestLongSqlExpression();
67         }
68
69         //Test case for bug #4708
70         [Test(Description="Test case for bug #4708")]
71         [Ignore ("JVM test")]
72         public void TestLongSqlExpression()
73         {
74                 BeginCase("Long SQL string cause java.lang.StackOverflowError (Test case for bug #4708)");
75
76                 StringBuilder querySb = new StringBuilder();
77                 querySb.Append("SELECT ");
78                 querySb.Append("c.CustomerID as ci1, c.CustomerID as ci2, c.CustomerID as ci3, c.CustomerID as ci4, ");
79                 querySb.Append("c.CompanyName as cn1, c.CompanyName as cn2, c.CompanyName as cn3, c.CompanyName as cn4, ");
80                 querySb.Append("c.ContactName as cntn1, c.ContactName as cntn2, c.ContactName as cntn3, c.ContactName as cntn4, ");
81                 querySb.Append("c.ContactTitle as ct1, c.ContactTitle as ct2, c.ContactTitle as ct3, c.ContactTitle as ct4, ");
82                 querySb.Append("c.Address as ad1, c.Address as ad2, c.Address as ad3, c.Address as ad4, ");
83                 querySb.Append("c.City as ct1, c.City as ct2, c.City as ct3, c.City as ct4, ");
84                 querySb.Append("c.Region as rg1, c.Region as rg2, c.Region as rg3, c.Region as rg4, ");
85                 querySb.Append("c.PostalCode as pc1, c.PostalCode as pc2, c.PostalCode as pc3, c.PostalCode as pc4, ");
86                 querySb.Append("c.Country as co1, c.Country as co2, c.Country as co3, c.Country as co4, ");
87                 querySb.Append("c.Phone as ph1, c.Phone as ph2, c.Phone as ph3, c.Phone as ph4, ");
88                 querySb.Append("c.Fax as fx1, c.Fax as fx2, c.Fax as fx3, c.Fax as fx4 ");
89                 querySb.Append("FROM Customers c");
90                 OracleDataAdapter adapter = null;
91                 DataSet schemaDs = new DataSet();
92                 try
93                 {
94                         using(adapter = new OracleDataAdapter(querySb.ToString(), this.connectionString))
95                         {
96                                 adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
97                                 adapter.FillSchema(schemaDs, SchemaType.Source);
98                                 Compare(schemaDs.Tables.Count, 1);
99                         }
100                 } 
101                 catch(Exception ex)
102                 {
103                         exp = ex;
104                 }
105                 finally
106                 {
107                         EndCase(exp);
108                         exp = null;
109                 }
110         }
111 }
112 }