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 
28 package ifc.script.framework.storage;
29 
30 import drafts.com.sun.star.script.framework.storage.XScriptStorageRefresh;
31 
32 import java.util.Collection;
33 import java.util.Iterator;
34 
35 import com.sun.star.uno.UnoRuntime;
36 import com.sun.star.lang.XMultiServiceFactory;
37 import com.sun.star.uno.XInterface;
38 import com.sun.star.ucb.XSimpleFileAccess;
39 import com.sun.star.uno.Exception;
40 import com.sun.star.beans.XPropertySet;
41 
42 import java.io.PrintWriter;
43 import lib.MultiMethodTest;
44 import lib.StatusException;
45 import lib.Parameters;
46 
47 public class _XScriptStorageRefresh extends MultiMethodTest {
48 
49     public XScriptStorageRefresh oObj = null;
50 
51     /**
52     * Retrieves object relation.
53     */
54     public void before() throws StatusException {
55     }
56 
57     public void _refresh() {
58         boolean result = true;
59 
60         Collection c =
61             (Collection) tEnv.getObjRelation("_refresh");
62 
63         if (c == null) {
64             tRes.tested("refresh()", false);
65             return;
66         }
67 
68         Iterator tests = c.iterator();
69 
70         while (tests.hasNext()) {
71             Parameters testdata = (Parameters)tests.next();
72             String expected = testdata.get("expected");
73             String output = "";
74 
75             log.println(testdata.get("description"));
76 
77             try {
78                 oObj.refresh();
79                 output = "success";
80             }
81             catch (com.sun.star.uno.RuntimeException re) {
82                 log.println("Caught RuntimeException: " + re);
83                 output = "com.sun.star.uno.RuntimeException";
84             }
85             log.println("expected: " + expected + ", output: " + output);
86             result &= output.equals(expected);
87         }
88         tRes.tested("refresh()", result);
89     }
90 }
91