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