xref: /trunk/main/package/qa/ofopxmlstorages/StorageUnitTest.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 package complex.ofopxmlstorages;
28 
29 import com.sun.star.lang.XMultiServiceFactory;
30 import com.sun.star.lang.XMultiComponentFactory;
31 import com.sun.star.connection.XConnector;
32 import com.sun.star.connection.XConnection;
33 
34 import com.sun.star.bridge.XUnoUrlResolver;
35 import com.sun.star.uno.UnoRuntime;
36 import com.sun.star.uno.XInterface;
37 import com.sun.star.uno.XNamingService;
38 import com.sun.star.uno.XComponentContext;
39 
40 import com.sun.star.container.*;
41 import com.sun.star.beans.*;
42 import com.sun.star.lang.*;
43 
44 import complexlib.ComplexTestCase;
45 
46 import complex.ofopxmlstorages.*;
47 
48 import util.utils;
49 import java.util.*;
50 import java.io.*;
51 
52 /* This unit test for storage objects is designed to
53  * test most important statements from storage service
54  * specification.
55  *
56  * Regression tests are added to extend the tested
57  * functionalities.
58  */
59 public class StorageUnitTest  extends ComplexTestCase
60 {
61     private XMultiServiceFactory m_xMSF = null;
62     private XSingleServiceFactory m_xStorageFactory = null;
63 
64     public String[] getTestMethodNames()
65     {
66         return new String[] {
67                                 "ExecuteTest01",
68                                 "ExecuteTest02",
69                                 "ExecuteTest03",
70                                 "ExecuteTest04",
71                                 "ExecuteTest05",
72                                 "ExecuteTest06",
73                                 "ExecuteTest07",
74                                 "ExecuteTest08"
75                             };
76     }
77 
78     public String getTestObjectName()
79     {
80         return "StorageUnitTest";
81     }
82 
83     public void before()
84     {
85         m_xMSF = (XMultiServiceFactory)param.getMSF();
86         if ( m_xMSF == null )
87         {
88             failed( "Can't create service factory!" );
89             return;
90         }
91 
92         try {
93             Object oStorageFactory = m_xMSF.createInstance( "com.sun.star.embed.StorageFactory" );
94             m_xStorageFactory = (XSingleServiceFactory)UnoRuntime.queryInterface( XSingleServiceFactory.class,
95                                                                                 oStorageFactory );
96         }
97         catch( Exception e )
98         {
99             failed( "Can't create storage factory!" );
100             return;
101         }
102 
103         if ( m_xStorageFactory == null )
104         {
105             failed( "Can't create service factory!" );
106             return;
107         }
108     }
109 
110     public void ExecuteTest01()
111     {
112         StorageTest aTest = new Test01( m_xMSF, m_xStorageFactory, log );
113         assure( "Test01 failed!", aTest.test() );
114     }
115 
116     public void ExecuteTest02()
117     {
118         StorageTest aTest = new Test02( m_xMSF, m_xStorageFactory, log );
119         assure( "Test02 failed!", aTest.test() );
120     }
121 
122     public void ExecuteTest03()
123     {
124         StorageTest aTest = new Test03( m_xMSF, m_xStorageFactory, log );
125         assure( "Test03 failed!", aTest.test() );
126     }
127 
128     public void ExecuteTest04()
129     {
130         StorageTest aTest = new Test04( m_xMSF, m_xStorageFactory, log );
131         assure( "Test04 failed!", aTest.test() );
132     }
133 
134     public void ExecuteTest05()
135     {
136         StorageTest aTest = new Test05( m_xMSF, m_xStorageFactory, log );
137         assure( "Test05 failed!", aTest.test() );
138     }
139 
140     public void ExecuteTest06()
141     {
142         StorageTest aTest = new Test06( m_xMSF, m_xStorageFactory, log );
143         assure( "Test06 failed!", aTest.test() );
144     }
145 
146     public void ExecuteTest07()
147     {
148         StorageTest aTest = new Test07( m_xMSF, m_xStorageFactory, log );
149         assure( "Test07 failed!", aTest.test() );
150     }
151 
152     public void ExecuteTest08()
153     {
154         StorageTest aTest = new Test08( m_xMSF, m_xStorageFactory, log );
155         assure( "Test08 failed!", aTest.test() );
156     }
157 }
158 
159