xref: /trunk/main/package/qa/ofopxmlstorages/StorageUnitTest.java (revision a740f2aac71e58ccad9369fb423cc251ef909663)
1*a740f2aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*a740f2aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*a740f2aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*a740f2aaSAndrew Rist  * distributed with this work for additional information
6*a740f2aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*a740f2aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*a740f2aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*a740f2aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*a740f2aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*a740f2aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*a740f2aaSAndrew Rist  * software distributed under the License is distributed on an
15*a740f2aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*a740f2aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*a740f2aaSAndrew Rist  * specific language governing permissions and limitations
18*a740f2aaSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*a740f2aaSAndrew Rist  *************************************************************/
21*a740f2aaSAndrew Rist 
22*a740f2aaSAndrew Rist 
23cdf0e10cSrcweir package complex.ofopxmlstorages;
24cdf0e10cSrcweir 
25cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
26cdf0e10cSrcweir import com.sun.star.lang.XMultiComponentFactory;
27cdf0e10cSrcweir import com.sun.star.connection.XConnector;
28cdf0e10cSrcweir import com.sun.star.connection.XConnection;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir import com.sun.star.bridge.XUnoUrlResolver;
31cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
32cdf0e10cSrcweir import com.sun.star.uno.XInterface;
33cdf0e10cSrcweir import com.sun.star.uno.XNamingService;
34cdf0e10cSrcweir import com.sun.star.uno.XComponentContext;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir import com.sun.star.container.*;
37cdf0e10cSrcweir import com.sun.star.beans.*;
38cdf0e10cSrcweir import com.sun.star.lang.*;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir import complexlib.ComplexTestCase;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir import complex.ofopxmlstorages.*;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir import util.utils;
45cdf0e10cSrcweir import java.util.*;
46cdf0e10cSrcweir import java.io.*;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir /* This unit test for storage objects is designed to
49cdf0e10cSrcweir  * test most important statements from storage service
50cdf0e10cSrcweir  * specification.
51cdf0e10cSrcweir  *
52cdf0e10cSrcweir  * Regression tests are added to extend the tested
53cdf0e10cSrcweir  * functionalities.
54cdf0e10cSrcweir  */
55cdf0e10cSrcweir public class StorageUnitTest  extends ComplexTestCase
56cdf0e10cSrcweir {
57cdf0e10cSrcweir     private XMultiServiceFactory m_xMSF = null;
58cdf0e10cSrcweir     private XSingleServiceFactory m_xStorageFactory = null;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     public String[] getTestMethodNames()
61cdf0e10cSrcweir     {
62cdf0e10cSrcweir         return new String[] {
63cdf0e10cSrcweir                                 "ExecuteTest01",
64cdf0e10cSrcweir                                 "ExecuteTest02",
65cdf0e10cSrcweir                                 "ExecuteTest03",
66cdf0e10cSrcweir                                 "ExecuteTest04",
67cdf0e10cSrcweir                                 "ExecuteTest05",
68cdf0e10cSrcweir                                 "ExecuteTest06",
69cdf0e10cSrcweir                                 "ExecuteTest07",
70cdf0e10cSrcweir                                 "ExecuteTest08"
71cdf0e10cSrcweir                             };
72cdf0e10cSrcweir     }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     public String getTestObjectName()
75cdf0e10cSrcweir     {
76cdf0e10cSrcweir         return "StorageUnitTest";
77cdf0e10cSrcweir     }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     public void before()
80cdf0e10cSrcweir     {
81cdf0e10cSrcweir         m_xMSF = (XMultiServiceFactory)param.getMSF();
82cdf0e10cSrcweir         if ( m_xMSF == null )
83cdf0e10cSrcweir         {
84cdf0e10cSrcweir             failed( "Can't create service factory!" );
85cdf0e10cSrcweir             return;
86cdf0e10cSrcweir         }
87cdf0e10cSrcweir 
88cdf0e10cSrcweir         try {
89cdf0e10cSrcweir             Object oStorageFactory = m_xMSF.createInstance( "com.sun.star.embed.StorageFactory" );
90cdf0e10cSrcweir             m_xStorageFactory = (XSingleServiceFactory)UnoRuntime.queryInterface( XSingleServiceFactory.class,
91cdf0e10cSrcweir                                                                                 oStorageFactory );
92cdf0e10cSrcweir         }
93cdf0e10cSrcweir         catch( Exception e )
94cdf0e10cSrcweir         {
95cdf0e10cSrcweir             failed( "Can't create storage factory!" );
96cdf0e10cSrcweir             return;
97cdf0e10cSrcweir         }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir         if ( m_xStorageFactory == null )
100cdf0e10cSrcweir         {
101cdf0e10cSrcweir             failed( "Can't create service factory!" );
102cdf0e10cSrcweir             return;
103cdf0e10cSrcweir         }
104cdf0e10cSrcweir     }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     public void ExecuteTest01()
107cdf0e10cSrcweir     {
108cdf0e10cSrcweir         StorageTest aTest = new Test01( m_xMSF, m_xStorageFactory, log );
109cdf0e10cSrcweir         assure( "Test01 failed!", aTest.test() );
110cdf0e10cSrcweir     }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     public void ExecuteTest02()
113cdf0e10cSrcweir     {
114cdf0e10cSrcweir         StorageTest aTest = new Test02( m_xMSF, m_xStorageFactory, log );
115cdf0e10cSrcweir         assure( "Test02 failed!", aTest.test() );
116cdf0e10cSrcweir     }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     public void ExecuteTest03()
119cdf0e10cSrcweir     {
120cdf0e10cSrcweir         StorageTest aTest = new Test03( m_xMSF, m_xStorageFactory, log );
121cdf0e10cSrcweir         assure( "Test03 failed!", aTest.test() );
122cdf0e10cSrcweir     }
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     public void ExecuteTest04()
125cdf0e10cSrcweir     {
126cdf0e10cSrcweir         StorageTest aTest = new Test04( m_xMSF, m_xStorageFactory, log );
127cdf0e10cSrcweir         assure( "Test04 failed!", aTest.test() );
128cdf0e10cSrcweir     }
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     public void ExecuteTest05()
131cdf0e10cSrcweir     {
132cdf0e10cSrcweir         StorageTest aTest = new Test05( m_xMSF, m_xStorageFactory, log );
133cdf0e10cSrcweir         assure( "Test05 failed!", aTest.test() );
134cdf0e10cSrcweir     }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     public void ExecuteTest06()
137cdf0e10cSrcweir     {
138cdf0e10cSrcweir         StorageTest aTest = new Test06( m_xMSF, m_xStorageFactory, log );
139cdf0e10cSrcweir         assure( "Test06 failed!", aTest.test() );
140cdf0e10cSrcweir     }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     public void ExecuteTest07()
143cdf0e10cSrcweir     {
144cdf0e10cSrcweir         StorageTest aTest = new Test07( m_xMSF, m_xStorageFactory, log );
145cdf0e10cSrcweir         assure( "Test07 failed!", aTest.test() );
146cdf0e10cSrcweir     }
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     public void ExecuteTest08()
149cdf0e10cSrcweir     {
150cdf0e10cSrcweir         StorageTest aTest = new Test08( m_xMSF, m_xStorageFactory, log );
151cdf0e10cSrcweir         assure( "Test08 failed!", aTest.test() );
152cdf0e10cSrcweir     }
153cdf0e10cSrcweir }
154cdf0e10cSrcweir 
155