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 
24 package ifc.container;
25 
26 import lib.MultiMethodTest;
27 
28 import com.sun.star.container.XContentEnumerationAccess;
29 import com.sun.star.container.XEnumeration;
30 
31 /**
32 * Testing <code>com.sun.star.container.XContentEnumerationAccess</code>
33 * interface methods :
34 * <ul>
35 *  <li><code> createContentEnumeration()</code></li>
36 *  <li><code> getAvailableServiceNames()</code></li>
37 * </ul> <p>
38 * @see com.sun.star.container.XContentEnumerationAccess
39 */
40 public class _XContentEnumerationAccess extends MultiMethodTest{
41     public XContentEnumerationAccess oObj = null;
42     String[] serviceNames = null;
43 
44     /**
45     * Retrieves service names and stores them. <p>
46     * Has <b> OK </b> status if not <code>null</code>
47     * value returned.
48     */
_getAvailableServiceNames()49     public void _getAvailableServiceNames(){
50         boolean bResult = true;
51         try {
52             serviceNames = oObj.getAvailableServiceNames();
53             bResult = serviceNames != null ;
54         } catch (Exception e) {
55             log.println("Exception occurred. " + e);
56             bResult = false;
57         }
58         tRes.tested("getAvailableServiceNames()", bResult);
59     }
60 
61     /**
62     * If at least one service available then an enumeration for
63     * it created. <p>
64     * Has <b> OK </b> status if no services available or enumeration
65     * created for available service is not <code>null</code>.
66     * The following method tests are to be completed successfully before :
67     * <ul>
68     *  <li> <code>getAvailableServiceNames()</code> :
69     *    to have at least one service name for enumeration to create for.</li>
70     * </ul>
71     */
_createContentEnumeration()72     public void _createContentEnumeration(){
73         requiredMethod("getAvailableServiceNames()");
74 
75         if (serviceNames.length == 0) {
76             log.println("No service name available") ;
77             tRes.tested("createContentEnumeration()", true) ;
78             return ;
79         }
80 
81         boolean bResult = true;
82 
83         log.println( "creating Enumeration" );
84         XEnumeration oEnum = oObj.createContentEnumeration(serviceNames[0]);
85         bResult &= oEnum != null;
86 
87         tRes.tested( "createContentEnumeration()",  bResult);
88     }
89 }
90 
91 
92