/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 * only, as published by the Free Software Foundation. * * OpenOffice.org is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License version 3 for more details * (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see * * for a copy of the LGPLv3 License. * ************************************************************************/ // package name: as default, start with complex package complex.api_internal; // imports import helper.OfficeProvider; import helper.ProcessHandler; import com.sun.star.task.XJob; import com.sun.star.beans.XPropertyAccess; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.beans.PropertyValue; import com.sun.star.uno.UnoRuntime; import com.sun.star.beans.NamedValue; import java.util.Vector; import java.util.StringTokenizer; // ---------- junit imports ----------------- import lib.TestParameters; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ /** * This test executes the API tests internally in StarOffice. Prerequiste is * that a OOoRunner.jar is registered inseide of StarOffice. Adjust the joblist * inside of the ChekAPI.props to determine which tetss will be executed. */ public class CheckAPI { // The name of the tested service private final String testName = "StarOfficeAPI"; /** * Return all test methods. * @return The test methods. */ // public String[] getTestMethodNames() { // return new String[]{"checkAPI"}; // } /** * The test parameters */ private static TestParameters param = null; /** * */ @Before public void before() { param = new TestParameters(); } /** * Execute the API tests inside of the Office. If the Office crashes, it * will be restarted and the job will continue after the one that caused the crash. */ @Test public void checkAPI() { System.out.println("Start with test"); // if test is idle for 5 minutes, assume that it hangs and kill it. // param.put("TimeOut", new Integer("300000")); /* AppProvider office = (AppProvider)dcl.getInstance("helper.OfficeProvider"); Object msf = office.getManager(param); if (msf == null) { failed("Could not connect an Office."); } param.put("ServiceFactory",msf); */ XMultiServiceFactory xMSF = getMSF(); Object oObj = null; try { oObj = xMSF.createInstance("org.openoffice.RunnerService"); } catch(com.sun.star.uno.Exception e) { fail("Could not create Instance of 'org.openoffice.RunnerService'"); } assertNotNull("Cannot create 'org.openoffice.RunnerService'", oObj); // get the parameters for the internal test String paramList = (String)param.get("ParamList"); Vector p = new Vector(); StringTokenizer paramTokens = new StringTokenizer(paramList, " "); while(paramTokens.hasMoreTokens()) { p.add(paramTokens.nextToken()); } int length = p.size()/2+1; NamedValue[] internalParams = new NamedValue[length]; for (int i=0; i LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff