1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir package mod._sc;
28*cdf0e10cSrcweir 
29*cdf0e10cSrcweir import com.sun.star.beans.XPropertySet;
30*cdf0e10cSrcweir import com.sun.star.container.XIndexAccess;
31*cdf0e10cSrcweir import com.sun.star.container.XNameAccess;
32*cdf0e10cSrcweir import com.sun.star.container.XNamed;
33*cdf0e10cSrcweir import com.sun.star.lang.XComponent;
34*cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
35*cdf0e10cSrcweir import com.sun.star.sheet.DataPilotFieldGroupInfo;
36*cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotDescriptor;
37*cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotFieldGrouping;
38*cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotTables;
39*cdf0e10cSrcweir import com.sun.star.sheet.XDataPilotTablesSupplier;
40*cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheet;
41*cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheetDocument;
42*cdf0e10cSrcweir import com.sun.star.sheet.XSpreadsheets;
43*cdf0e10cSrcweir import com.sun.star.table.CellAddress;
44*cdf0e10cSrcweir import com.sun.star.table.CellRangeAddress;
45*cdf0e10cSrcweir import com.sun.star.uno.AnyConverter;
46*cdf0e10cSrcweir import com.sun.star.uno.Type;
47*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
48*cdf0e10cSrcweir import com.sun.star.uno.XInterface;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir import java.io.PrintWriter;
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir import lib.StatusException;
53*cdf0e10cSrcweir import lib.TestCase;
54*cdf0e10cSrcweir import lib.TestEnvironment;
55*cdf0e10cSrcweir import lib.TestParameters;
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir import util.SOfficeFactory;
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir public class ScDataPilotFieldGroupItemObj extends TestCase
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir     static XSpreadsheetDocument xSheetDoc = null;
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir     /**
66*cdf0e10cSrcweir      * A field is filled some values. This integer determines the size of the
67*cdf0e10cSrcweir      * field in x and y direction.
68*cdf0e10cSrcweir      */
69*cdf0e10cSrcweir     private int mMaxFieldIndex = 6;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir     /**
72*cdf0e10cSrcweir      * Creates Spreadsheet document.
73*cdf0e10cSrcweir      */
74*cdf0e10cSrcweir     protected void initialize (TestParameters tParam, PrintWriter log)
75*cdf0e10cSrcweir     {
76*cdf0e10cSrcweir         SOfficeFactory SOF = SOfficeFactory.getFactory (
77*cdf0e10cSrcweir             (XMultiServiceFactory) tParam.getMSF ());
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir         try
80*cdf0e10cSrcweir         {
81*cdf0e10cSrcweir             log.println ("creating a Spreadsheet document");
82*cdf0e10cSrcweir             xSheetDoc = SOF.createCalcDoc (null);
83*cdf0e10cSrcweir         }
84*cdf0e10cSrcweir         catch (com.sun.star.uno.Exception e)
85*cdf0e10cSrcweir         {
86*cdf0e10cSrcweir             // Some exception occures.FAILED
87*cdf0e10cSrcweir             e.printStackTrace (log);
88*cdf0e10cSrcweir             throw new StatusException ("Couldn't create document", e);
89*cdf0e10cSrcweir         }
90*cdf0e10cSrcweir     }
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     /**
93*cdf0e10cSrcweir      * Disposes Spreadsheet document.
94*cdf0e10cSrcweir      */
95*cdf0e10cSrcweir     protected void cleanup (TestParameters tParam, PrintWriter log)
96*cdf0e10cSrcweir     {
97*cdf0e10cSrcweir         log.println ("    disposing xSheetDoc ");
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir         XComponent oComp = (XComponent) UnoRuntime.queryInterface (
100*cdf0e10cSrcweir             XComponent.class, xSheetDoc);
101*cdf0e10cSrcweir         util.DesktopTools.closeDoc (oComp);
102*cdf0e10cSrcweir     }
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir     protected synchronized TestEnvironment createTestEnvironment (TestParameters Param,
105*cdf0e10cSrcweir         PrintWriter log)
106*cdf0e10cSrcweir     {
107*cdf0e10cSrcweir         XInterface oObj = null;
108*cdf0e10cSrcweir         XInterface datapilotfield = null;
109*cdf0e10cSrcweir         XInterface groups = null;
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir         // creation of testobject here
112*cdf0e10cSrcweir         // first we write what we are intend to do to log file
113*cdf0e10cSrcweir         log.println ("Creating a test environment");
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir         // the cell range
116*cdf0e10cSrcweir         CellRangeAddress sCellRangeAdress = new CellRangeAddress ();
117*cdf0e10cSrcweir         sCellRangeAdress.Sheet = 0;
118*cdf0e10cSrcweir         sCellRangeAdress.StartColumn = 1;
119*cdf0e10cSrcweir         sCellRangeAdress.StartRow = 0;
120*cdf0e10cSrcweir         sCellRangeAdress.EndColumn = mMaxFieldIndex - 1;
121*cdf0e10cSrcweir         sCellRangeAdress.EndRow = mMaxFieldIndex - 1;
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir         // position of the data pilot table
124*cdf0e10cSrcweir         CellAddress sCellAdress = new CellAddress ();
125*cdf0e10cSrcweir         sCellAdress.Sheet = 0;
126*cdf0e10cSrcweir         sCellAdress.Column = 7;
127*cdf0e10cSrcweir         sCellAdress.Row = 8;
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir         log.println ("Getting a sheet");
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir         XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets ();
132*cdf0e10cSrcweir         XSpreadsheet oSheet = null;
133*cdf0e10cSrcweir         XSpreadsheet oSheet2 = null;
134*cdf0e10cSrcweir         XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface (
135*cdf0e10cSrcweir             XIndexAccess.class, xSpreadsheets);
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir         try
138*cdf0e10cSrcweir         {
139*cdf0e10cSrcweir             oSheet = (XSpreadsheet) AnyConverter.toObject (
140*cdf0e10cSrcweir                 new Type (XSpreadsheet.class),
141*cdf0e10cSrcweir                 oIndexAccess.getByIndex (0));
142*cdf0e10cSrcweir             oSheet2 = (XSpreadsheet) AnyConverter.toObject (
143*cdf0e10cSrcweir                 new Type (XSpreadsheet.class),
144*cdf0e10cSrcweir                 oIndexAccess.getByIndex (1));
145*cdf0e10cSrcweir         }
146*cdf0e10cSrcweir         catch (com.sun.star.lang.WrappedTargetException e)
147*cdf0e10cSrcweir         {
148*cdf0e10cSrcweir             e.printStackTrace ();
149*cdf0e10cSrcweir             throw new StatusException ("Couldn't get a spreadsheet", e);
150*cdf0e10cSrcweir         }
151*cdf0e10cSrcweir         catch (com.sun.star.lang.IndexOutOfBoundsException e)
152*cdf0e10cSrcweir         {
153*cdf0e10cSrcweir             e.printStackTrace ();
154*cdf0e10cSrcweir             throw new StatusException ("Couldn't get a spreadsheet", e);
155*cdf0e10cSrcweir         }
156*cdf0e10cSrcweir         catch (com.sun.star.lang.IllegalArgumentException e)
157*cdf0e10cSrcweir         {
158*cdf0e10cSrcweir             e.printStackTrace ();
159*cdf0e10cSrcweir             throw new StatusException ("Couldn't get a spreadsheet", e);
160*cdf0e10cSrcweir         }
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir         try
163*cdf0e10cSrcweir         {
164*cdf0e10cSrcweir             log.println ("Filling a table");
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir             for (int i = 1; i < mMaxFieldIndex; i++)
167*cdf0e10cSrcweir             {
168*cdf0e10cSrcweir                 oSheet.getCellByPosition (i, 0).setFormula ("Col" + i);
169*cdf0e10cSrcweir                 oSheet.getCellByPosition (0, i).setFormula ("Row" + i);
170*cdf0e10cSrcweir                 oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i);
171*cdf0e10cSrcweir                 oSheet2.getCellByPosition (0, i).setFormula ("Row" + i);
172*cdf0e10cSrcweir             }
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir             for (int i = 1; i < mMaxFieldIndex; i++)
175*cdf0e10cSrcweir             {
176*cdf0e10cSrcweir                 for (int j = 1; j < mMaxFieldIndex; j++)
177*cdf0e10cSrcweir                 {
178*cdf0e10cSrcweir                     oSheet.getCellByPosition (i, j).setValue (i * (j + 1));
179*cdf0e10cSrcweir                     oSheet2.getCellByPosition (i, j).setValue (i * (j + 2));
180*cdf0e10cSrcweir                 }
181*cdf0e10cSrcweir             }
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir             oSheet.getCellByPosition (1, 1).setFormula ("aName");
184*cdf0e10cSrcweir             oSheet.getCellByPosition (1, 2).setFormula ("otherName");
185*cdf0e10cSrcweir             oSheet.getCellByPosition (1, 3).setFormula ("una");
186*cdf0e10cSrcweir             oSheet.getCellByPosition (1, 4).setFormula ("otherName");
187*cdf0e10cSrcweir             oSheet.getCellByPosition (1, 5).setFormula ("somethingelse");
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir         }
190*cdf0e10cSrcweir         catch (com.sun.star.lang.IndexOutOfBoundsException e)
191*cdf0e10cSrcweir         {
192*cdf0e10cSrcweir             e.printStackTrace ();
193*cdf0e10cSrcweir             throw new StatusException ("Couldn't fill some cells", e);
194*cdf0e10cSrcweir         }
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir         // change a value of a cell and check the change in the data pilot
197*cdf0e10cSrcweir         // (for the XDataPilotTable.refresh() test)
198*cdf0e10cSrcweir         Object oChangeCell = null;
199*cdf0e10cSrcweir         Object oCheckCell = null;
200*cdf0e10cSrcweir         Integer aChangeValue = null;
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir         try
203*cdf0e10cSrcweir         {
204*cdf0e10cSrcweir             // cell of data
205*cdf0e10cSrcweir             oChangeCell = oSheet.getCellByPosition (1, 5);
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir             int x = sCellAdress.Column;
208*cdf0e10cSrcweir             int y = sCellAdress.Row + 3;
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir             // cell of the data pilot output
212*cdf0e10cSrcweir             oCheckCell = oSheet.getCellByPosition (x, y);
213*cdf0e10cSrcweir             aChangeValue = new Integer (27);
214*cdf0e10cSrcweir         }
215*cdf0e10cSrcweir         catch (com.sun.star.lang.IndexOutOfBoundsException e)
216*cdf0e10cSrcweir         {
217*cdf0e10cSrcweir             e.printStackTrace ();
218*cdf0e10cSrcweir             throw new StatusException ("Couldn't get cells for changeing.", e);
219*cdf0e10cSrcweir         }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir         // create the test objects
223*cdf0e10cSrcweir         log.println ("Getting test objects");
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir         XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) UnoRuntime.queryInterface (
226*cdf0e10cSrcweir             XDataPilotTablesSupplier.class,
227*cdf0e10cSrcweir             oSheet);
228*cdf0e10cSrcweir         XDataPilotTables DPT = DPTS.getDataPilotTables ();
229*cdf0e10cSrcweir         XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor ();
230*cdf0e10cSrcweir         DPDsc.setSourceRange (sCellRangeAdress);
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir         XPropertySet fieldPropSet = null;
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir         try
235*cdf0e10cSrcweir         {
236*cdf0e10cSrcweir             Object oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (0);
237*cdf0e10cSrcweir             fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
238*cdf0e10cSrcweir                 XPropertySet.class, oDataPilotField);
239*cdf0e10cSrcweir             fieldPropSet.setPropertyValue ("Orientation",
240*cdf0e10cSrcweir                 com.sun.star.sheet.DataPilotFieldOrientation.ROW);
241*cdf0e10cSrcweir             oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (1);
242*cdf0e10cSrcweir             fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
243*cdf0e10cSrcweir                 XPropertySet.class, oDataPilotField);
244*cdf0e10cSrcweir             fieldPropSet.setPropertyValue ("Function",
245*cdf0e10cSrcweir                 com.sun.star.sheet.GeneralFunction.SUM);
246*cdf0e10cSrcweir             fieldPropSet.setPropertyValue ("Orientation",
247*cdf0e10cSrcweir                 com.sun.star.sheet.DataPilotFieldOrientation.DATA);
248*cdf0e10cSrcweir             oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (2);
249*cdf0e10cSrcweir             fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
250*cdf0e10cSrcweir                 XPropertySet.class, oDataPilotField);
251*cdf0e10cSrcweir             fieldPropSet.setPropertyValue ("Orientation",
252*cdf0e10cSrcweir                 com.sun.star.sheet.DataPilotFieldOrientation.COLUMN);
253*cdf0e10cSrcweir         }
254*cdf0e10cSrcweir         catch (com.sun.star.lang.WrappedTargetException e)
255*cdf0e10cSrcweir         {
256*cdf0e10cSrcweir             e.printStackTrace ();
257*cdf0e10cSrcweir             throw new StatusException ("Couldn't create a test environment", e);
258*cdf0e10cSrcweir         }
259*cdf0e10cSrcweir         catch (com.sun.star.lang.IllegalArgumentException e)
260*cdf0e10cSrcweir         {
261*cdf0e10cSrcweir             e.printStackTrace ();
262*cdf0e10cSrcweir             throw new StatusException ("Couldn't create a test environment", e);
263*cdf0e10cSrcweir         }
264*cdf0e10cSrcweir         catch (com.sun.star.beans.PropertyVetoException e)
265*cdf0e10cSrcweir         {
266*cdf0e10cSrcweir             e.printStackTrace ();
267*cdf0e10cSrcweir             throw new StatusException ("Couldn't create a test environment", e);
268*cdf0e10cSrcweir         }
269*cdf0e10cSrcweir         catch (com.sun.star.beans.UnknownPropertyException e)
270*cdf0e10cSrcweir         {
271*cdf0e10cSrcweir             e.printStackTrace ();
272*cdf0e10cSrcweir             throw new StatusException ("Couldn't create a test environment", e);
273*cdf0e10cSrcweir         }
274*cdf0e10cSrcweir         catch (com.sun.star.lang.IndexOutOfBoundsException e)
275*cdf0e10cSrcweir         {
276*cdf0e10cSrcweir             e.printStackTrace ();
277*cdf0e10cSrcweir             throw new StatusException ("Couldn't create a test environment", e);
278*cdf0e10cSrcweir         }
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir         log.println ("Insert the DataPilotTable");
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir         if (DPT.hasByName ("DataPilotTable"))
283*cdf0e10cSrcweir         {
284*cdf0e10cSrcweir             DPT.removeByName ("DataPilotTable");
285*cdf0e10cSrcweir         }
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir         DPT.insertNewByName ("DataPilotTable", sCellAdress, DPDsc);
288*cdf0e10cSrcweir         XIndexAccess xIA = (XIndexAccess) UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ());
289*cdf0e10cSrcweir         XIndexAccess IA = null;
290*cdf0e10cSrcweir         try
291*cdf0e10cSrcweir         {
292*cdf0e10cSrcweir             XDataPilotDescriptor xDPT = (XDataPilotDescriptor) UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0));
293*cdf0e10cSrcweir             IA = xDPT.getRowFields ();
294*cdf0e10cSrcweir             //getSRange(IA);
295*cdf0e10cSrcweir             System.out.println ("COUNT: "+IA.getCount ());
296*cdf0e10cSrcweir             datapilotfield = (XInterface) AnyConverter.toObject (
297*cdf0e10cSrcweir                 new Type (XInterface.class), IA.getByIndex (0));
298*cdf0e10cSrcweir         }
299*cdf0e10cSrcweir         catch (com.sun.star.lang.WrappedTargetException e)
300*cdf0e10cSrcweir         {
301*cdf0e10cSrcweir             e.printStackTrace ();
302*cdf0e10cSrcweir             throw new StatusException ("Couldn't get data pilot field", e);
303*cdf0e10cSrcweir         }
304*cdf0e10cSrcweir         catch (com.sun.star.lang.IndexOutOfBoundsException e)
305*cdf0e10cSrcweir         {
306*cdf0e10cSrcweir             e.printStackTrace ();
307*cdf0e10cSrcweir             throw new StatusException ("Couldn't get data pilot field", e);
308*cdf0e10cSrcweir         }
309*cdf0e10cSrcweir         catch (com.sun.star.lang.IllegalArgumentException e)
310*cdf0e10cSrcweir         {
311*cdf0e10cSrcweir             e.printStackTrace ();
312*cdf0e10cSrcweir             throw new StatusException ("Couldn't get data pilot field", e);
313*cdf0e10cSrcweir         }
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir         try
316*cdf0e10cSrcweir         {
317*cdf0e10cSrcweir             XDataPilotFieldGrouping  dpfg = (XDataPilotFieldGrouping) UnoRuntime.queryInterface (XDataPilotFieldGrouping.class, datapilotfield);
318*cdf0e10cSrcweir             String[] elements = new String[]{"aName","otherName"};
319*cdf0e10cSrcweir             dpfg.createNameGroup (elements);
320*cdf0e10cSrcweir             DataPilotFieldGroupInfo dpgi=null;
321*cdf0e10cSrcweir             xIA = (XIndexAccess) UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ());
322*cdf0e10cSrcweir         try
323*cdf0e10cSrcweir         {
324*cdf0e10cSrcweir             XDataPilotDescriptor xDPT = (XDataPilotDescriptor) UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0));
325*cdf0e10cSrcweir             IA = xDPT.getRowFields ();
326*cdf0e10cSrcweir         }
327*cdf0e10cSrcweir         catch (com.sun.star.lang.WrappedTargetException e)
328*cdf0e10cSrcweir         {
329*cdf0e10cSrcweir             e.printStackTrace ();
330*cdf0e10cSrcweir             throw new StatusException ("Couldn't get data pilot field", e);
331*cdf0e10cSrcweir         }
332*cdf0e10cSrcweir         catch (com.sun.star.lang.IndexOutOfBoundsException e)
333*cdf0e10cSrcweir         {
334*cdf0e10cSrcweir             e.printStackTrace ();
335*cdf0e10cSrcweir             throw new StatusException ("Couldn't get data pilot field", e);
336*cdf0e10cSrcweir         }
337*cdf0e10cSrcweir             for (int i=0;i<IA.getCount ();i++)
338*cdf0e10cSrcweir             {
339*cdf0e10cSrcweir                 datapilotfield = (XInterface) AnyConverter.toObject (
340*cdf0e10cSrcweir                     new Type (XInterface.class), IA.getByIndex (i));
341*cdf0e10cSrcweir                 XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface (XPropertySet.class, IA.getByIndex (i));
342*cdf0e10cSrcweir                 if (((Boolean)xPropertySet.getPropertyValue ("IsGroupField")).booleanValue ())
343*cdf0e10cSrcweir                 {
344*cdf0e10cSrcweir                     xPropertySet = (XPropertySet) UnoRuntime.queryInterface (XPropertySet.class, datapilotfield);
345*cdf0e10cSrcweir                     XNamed xNamed = (XNamed) UnoRuntime.queryInterface (XNamed.class, IA.getByIndex (i));
346*cdf0e10cSrcweir                     System.out.println ("name: "+xNamed.getName ());
347*cdf0e10cSrcweir                     dpgi = (DataPilotFieldGroupInfo) xPropertySet.getPropertyValue ("GroupInfo");
348*cdf0e10cSrcweir                 }
349*cdf0e10cSrcweir             }
350*cdf0e10cSrcweir             groups = dpgi.Groups;
351*cdf0e10cSrcweir             XIndexAccess groupAccess = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, groups);
352*cdf0e10cSrcweir             XNameAccess groupNames = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, groupAccess.getByIndex(0));
353*cdf0e10cSrcweir             oObj = (XInterface) UnoRuntime.queryInterface(XInterface.class, groupNames.getByName("aName"));
354*cdf0e10cSrcweir         }
355*cdf0e10cSrcweir         catch (Exception e)
356*cdf0e10cSrcweir         {
357*cdf0e10cSrcweir             e.printStackTrace ();
358*cdf0e10cSrcweir         }
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir         log.println ("Creating object - " +
361*cdf0e10cSrcweir             ((oObj == null) ? "FAILED" : "OK"));
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir         TestEnvironment tEnv = new TestEnvironment (oObj);
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir         log.println ("Implementationname: " + util.utils.getImplName (oObj));
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir         // Other parameters required for interface tests
368*cdf0e10cSrcweir         return tEnv;
369*cdf0e10cSrcweir     }
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir }
372