Examples of OfficeProvider


Examples of helper.OfficeProvider

     */
    public void checkModule(String module) {
        log.println(utils.getDateTime() + ": start testing module '" + module + "'");

        log.println("start new Office instance...");
        OfficeProvider officeProvider = new OfficeProvider();
        log.println("Receiving the ServiceManager of the Office ");
        XMultiServiceFactory msf = (XMultiServiceFactory) officeProvider.getManager(param);
        assure("couldnot get ServiceFarcotry", msf != null, mContinue);
        param.put("ServiceFactory", msf);
       
        String sep = System.getProperty("file.separator");
        String sUnoapi = getModulePath(module);
        File fUnoapi = new File(sUnoapi);
        String sMakeFile = sUnoapi + sep + "makefile.mk";
        File fMakeFile = new File(sMakeFile);
        assure("ERROR: could not find makefile: '" + sMakeFile + "'", fMakeFile.exists(), mContinue);

        String[] cmdLines = getCmdLines(sUnoapi);
        ProcessHandler procHdl = runShellCommand(cmdLines, fUnoapi, false);
        if (mDebug) {
            log.println("---> Output of dmake:");
            log.println(procHdl.getOutputText());
            log.println("<--- Output of dmake file:");
            log.println("---> Error output of dmake file");
            log.println(procHdl.getErrorText());
            log.println("<--- Error output of dmake file");
        }
        assure("module failed", verifyOutput(procHdl.getOutputText()), mContinue);

        log.println("kill existing office...");
        try {
            officeProvider.closeExistingOffice(param, true);
        } catch (java.lang.UnsatisfiedLinkError exception) {
            log.println("Office seems not to be running");
        }

    }
View Full Code Here

Examples of helper.OfficeProvider

    void runGDCWithStatus(HTMLOutputter _aHTMLoutput, LISTOutputter _aLISToutput, String _sInputFile, String _sOutputPath, String _sReferencePath, String _sDiffPath, String _sNewSubDir )
        {
            // start a fresh Office
            GraphicalTestArguments aGTA = getGraphicalTestArguments();

            OfficeProvider aProvider = null;
            // SimpleFileSemaphore aSemaphore = new SimpleFileSemaphore();
            if (aGTA.shouldOfficeStart())
            {
                // if (OSHelper.isWindows())
                // {
                //     aSemaphore.P(aSemaphore.getSemaphoreFile());
                // }
               
                aGTA.getPerformance().startTime(PerformanceContainer.OfficeStart);
                aProvider = new OfficeProvider();
                XMultiServiceFactory xMSF = (XMultiServiceFactory) aProvider.getManager(param);
                param.put("ServiceFactory", xMSF);
                aGTA.getPerformance().stopTime(PerformanceContainer.OfficeStart);

                long nStartTime = aGTA.getPerformance().getTime(PerformanceContainer.OfficeStart);
                aGTA = getGraphicalTestArguments(); // get new TestArguments
                aGTA.getPerformance().setTime(PerformanceContainer.OfficeStart, nStartTime);
            }
           
            // Watcher Object is need in log object to give a simple way to say if a running office is alive.
            // As long as a log comes, it pings the Watcher and says the office is alive, if not an
            // internal counter increase and at a given point (300 seconds) the office is killed.
            GlobalLogWriter.get().println("Set office watcher");
            OfficeWatcher aWatcher = (OfficeWatcher)param.get("Watcher");
            GlobalLogWriter.get().setWatcher(aWatcher);
            // initializeWatcher(param);

            String sStatusRunThrough = "";
            String sStatusMessage = "";
            try
            {
                DB.destination_start();
                // better was:
                // load document
                // create postscript from document
                // check file
                GraphicalDifferenceCheck.checkOneFile(_sInputFile, _sOutputPath, _sReferencePath, _sDiffPath, aGTA);
                sStatusRunThrough = "PASSED, OK";
                DB.destination_finished();
            }
            catch(ConvWatchCancelException e)
            {
                assure(e.getMessage(), false, true);
                sStatusRunThrough = "CANCELLED, FAILED";
                sStatusMessage = e.getMessage();
                DB.destination_failed(sStatusRunThrough, sStatusMessage);
            }
            catch(ConvWatchException e)
            {
                assure(e.getMessage(), false, true);
                sStatusMessage = e.getMessage();
                sStatusRunThrough = "PASSED, FAILED";
                DB.destination_failed(sStatusRunThrough, sStatusMessage);
            }
            catch(com.sun.star.lang.DisposedException e)
            {
                assure(e.getMessage(), false, true);
                sStatusMessage = e.getMessage();
                sStatusRunThrough = "FAILED, FAILED";
                DB.destination_failed(sStatusRunThrough, sStatusMessage);
            }
       
            GlobalLogWriter.get().println("Watcher count is: " + aWatcher.getPing());

            // Office shutdown
            if (aProvider != null)
            {
                aProvider.closeExistingOffice(param, true);
                // if (OSHelper.isWindows())
                // {
                //     aSemaphore.V(aSemaphore.getSemaphoreFile());
                //     aSemaphore.sleep(2);
                //     // wait some time maybe an other process will take the semaphore
View Full Code Here

Examples of helper.OfficeProvider

    void runGDCWithStatus(HTMLOutputter _aHTMLoutput, LISTOutputter _aLISToutput, String _sInputFile, String _sOutputPath, String _sReferencePath, String _sDiffPath, String _sNewSubDir )
        {
            // start a fresh Office
            GraphicalTestArguments aGTA = getGraphicalTestArguments();

            OfficeProvider aProvider = null;
            // SimpleFileSemaphore aSemaphore = new SimpleFileSemaphore();
            if (aGTA.shouldOfficeStart())
            {
                // if (OSHelper.isWindows())
                // {
                //     aSemaphore.P(aSemaphore.getSemaphoreFile());
                // }
               
                aGTA.getPerformance().startTime(PerformanceContainer.OfficeStart);
                aProvider = new OfficeProvider();
                XMultiServiceFactory xMSF = (XMultiServiceFactory) aProvider.getManager(param);
                param.put("ServiceFactory", xMSF);
                aGTA.getPerformance().stopTime(PerformanceContainer.OfficeStart);

                long nStartTime = aGTA.getPerformance().getTime(PerformanceContainer.OfficeStart);
                aGTA = getGraphicalTestArguments(); // get new TestArguments
                aGTA.getPerformance().setTime(PerformanceContainer.OfficeStart, nStartTime);
            }
           
            // Watcher Object is need in log object to give a simple way to say if a running office is alive.
            // As long as a log comes, it pings the Watcher and says the office is alive, if not an
            // internal counter increase and at a given point (300 seconds) the office is killed.
            GlobalLogWriter.get().println("Set office watcher");
            OfficeWatcher aWatcher = (OfficeWatcher)param.get("Watcher");
            GlobalLogWriter.get().setWatcher(aWatcher);
            // initializeWatcher(param);

            String sStatusRunThrough = "";
            String sStatusMessage = "";
            try
            {
                DB.destination_start();
                // better was:
                // load document
                // create postscript from document
                // check file
                GraphicalDifferenceCheck.checkOneFile(_sInputFile, _sOutputPath, _sReferencePath, _sDiffPath, aGTA);
                sStatusRunThrough = "PASSED, OK";
                DB.destination_finished();
            }
            catch(ConvWatchCancelException e)
            {
                assure(e.getMessage(), false, true);
                sStatusRunThrough = "CANCELLED, FAILED";
                sStatusMessage = e.getMessage();
                DB.destination_failed(sStatusRunThrough, sStatusMessage);
            }
            catch(ConvWatchException e)
            {
                assure(e.getMessage(), false, true);
                sStatusMessage = e.getMessage();
                sStatusRunThrough = "PASSED, FAILED";
                DB.destination_failed(sStatusRunThrough, sStatusMessage);
            }
            catch(com.sun.star.lang.DisposedException e)
            {
                assure(e.getMessage(), false, true);
                sStatusMessage = e.getMessage();
                sStatusRunThrough = "FAILED, FAILED";
                DB.destination_failed(sStatusRunThrough, sStatusMessage);
            }
       
            GlobalLogWriter.get().println("Watcher count is: " + aWatcher.getPing());

            // Office shutdown
            if (aProvider != null)
            {
                aProvider.closeExistingOffice(param, true);
                // if (OSHelper.isWindows())
                // {
                //     aSemaphore.V(aSemaphore.getSemaphoreFile());
                //     aSemaphore.sleep(2);
                //     // wait some time maybe an other process will take the semaphore
View Full Code Here

Examples of helper.OfficeProvider

            // this test is desingt to run against a freshly installed office. Maybe this office has currently no
            // no user installation. The first start of an office creates this installation and this takes some
            // more time to connect to the office.
            // Note: This is only usefull with parameter -NoOffice true
            try {
                final OfficeProvider officeProvider = new OfficeProvider();
                log.println("Receiving the ServiceManager of the Office to create User installation...");

                final int timeOut = param.getInt(PropertyName.TIME_OUT);
                param.put(PropertyName.TIME_OUT, new Integer(4 * timeOut));

                final XMultiServiceFactory msf = (XMultiServiceFactory) officeProvider.getManager(param);

                officeProvider.backupUserLayer(param, msf);

                param.put(PropertyName.TIME_OUT, new Integer(timeOut));

                if (msf == null) {
                    failed("Could not connect the office");
View Full Code Here

Examples of helper.OfficeProvider

     */
    public void checkModule(String module) {
        log.println(utils.getDateTime() + ": start testing module '" + module + "'");

        log.println(utils.getDateTime() + "start new Office instance...");
        final OfficeProvider officeProvider = new OfficeProvider();
        log.println(utils.getDateTime() + "Receiving the ServiceManager of the Office ");
        final XMultiServiceFactory msf = (XMultiServiceFactory) officeProvider.getManager(param);
        assure("couldnot get ServiceFarcotry", msf != null, mContinue);
        param.put("ServiceFactory", msf);

        final String sep = System.getProperty("file.separator");
        final String sUnoapi = getModulePath(module);
        final File fUnoapi = new File(sUnoapi);
        final String sMakeFile = sUnoapi + sep + "makefile.mk";
        final File fMakeFile = new File(sMakeFile);
        assure("ERROR: could not find makefile: '" + sMakeFile + "'", fMakeFile.exists(), mContinue);

        final String[] commands = getCommands(sUnoapi);

        final ProcessHandler procHdl = bet.runCommandsInEnvironmentShell(commands, fUnoapi, false);
        log.println("exit code of dmake: " + procHdl.getExitCode());
        String test = procHdl.getOutputText();
        test = procHdl.getErrorText();
//        if (mDebug) {
//            log.println("---> Output of dmake:");
//            log.println(procHdl.getOutputText());
//            log.println("<--- Output of dmake:");
//            log.println("---> Error output of dmake:");
//            log.println(procHdl.getErrorText());
//            log.println("<--- Error output of dmake:");
//        }
        assure("module '" + module + "' failed", verifyOutput(procHdl.getOutputText()), mContinue);
        log.println(utils.getDateTime() + " module '" + module + "': kill existing office...");
        try {
            officeProvider.closeExistingOffice(param, true);
        } catch (java.lang.UnsatisfiedLinkError exception) {
            log.println("Office seems not to be running");
        }

    }
View Full Code Here

Examples of helper.OfficeProvider

            // we don't need to start a new office.
            GraphicalTestArguments aGTA_local = getGraphicalTestArguments();
            // if (GraphicalDifferenceCheck.isReferenceExists(_sInputFile, _sReferencePath, aGTA_local) == false)
            // {
            // start a fresh Office
            OfficeProvider aProvider = null;
            if (aGTA_local.restartOffice())
            {
                aProvider = new OfficeProvider();
                XMultiServiceFactory xMSF = (XMultiServiceFactory) aProvider.getManager(param);
                param.put("ServiceFactory", xMSF);
            }
            GraphicalTestArguments aGTA = getGraphicalTestArguments();
           
            if (aGTA.getOfficeProgram().toLowerCase().equals("msoffice"))
            {
                // ReferenceType is MSOffice
                GlobalLogWriter.get().println("USE MSOFFICE AS EXPORT FORMAT.");
                MSOfficePrint a = new MSOfficePrint();
                try
                {
                    String sInputFileBasename = FileHelper.getBasename(_sInputFile);
                    String fs = System.getProperty("file.separator");
                    FileHelper.makeDirectories("", _sReferencePath);
                    String sOutputFile = _sReferencePath;
                    if (sOutputFile.endsWith(fs))
                    {
                        sOutputFile += sInputFileBasename;
                    }
                    else
                    {
                        sOutputFile += fs + sInputFileBasename;
                    }
                   
                    a.storeToFileWithMSOffice(aGTA, _sInputFile, sOutputFile);
                }
                catch(ConvWatchCancelException e)
                {
                    GlobalLogWriter.get().println(e.getMessage());
                }
                catch(java.io.IOException e)
                {
                    GlobalLogWriter.get().println(e.getMessage());
                }
            }
            else
            {
                try
                {
                    OfficePrint.convertDocument(_sInputFile, _sReferencePath, aGTA);
                }
                catch(ConvWatchCancelException e)
                {
                    assure(e.getMessage(), false);
                }
                catch(ConvWatchException e)
                {
                    assure(e.getMessage(), false);
                }
            }
           
            if (aGTA.restartOffice())
            {
                // Office shutdown
                aProvider.closeExistingOffice(param, true);
            }
            // }
        }
View Full Code Here

Examples of helper.OfficeProvider

     @param return True, if the test was executed.
     */
    public boolean executeTest(TestParameters param) {
        DescGetter dg = new APIDescGetter();
        String job = (String) param.get("TestJob");
        OfficeProvider office = null;
        debug = param.getBool("DebugIsActive");


        //get Job-Descriptions
        System.out.print("Getting Descriptions for Job: " + job + " from ");

        DescEntry[] entries = dg.getDescriptionFor(job,
                                                   (String) param.get(
                                                           "DescriptionPath"),
                                                   debug);

        if (entries == null) {
            System.out.println("Couldn't get Description for Job");

            return false;
        }

        String ExclusionFile = (String) param.get("ExclusionList");
        Vector exclusions = null;

        if (ExclusionFile != null) {
            exclusions = getExclusionList(ExclusionFile, debug);
        }

        String conStr = (String) param.get("ConnectionString");
        System.out.println("");
        System.out.print("> Connecting the Office ");
        System.out.println("With " + conStr);

        for (int l = 0; l < entries.length; l++) {
            if (entries[l].hasErrorMsg) {
                System.out.println(entries[l].ErrorMsg);

                continue;
            }

            office = new OfficeProvider();

            XMultiServiceFactory msf = (XMultiServiceFactory) office.getManager(
                                               param);

            if (msf == null) {
                return false;
            }

            param.put("ServiceFactory", msf);

            DescEntry entry = entries[l];

            //get some helper classes
            Summarizer sumIt = new Summarizer();
            DynamicClassLoader dcl = new DynamicClassLoader();

            TestCase tCase = null;

            tCase = (TestCase) new BasicTestCase(entry);

            if (tCase == null) {
                sumIt.summarizeDown(entry, entry.ErrorMsg);

                LogWriter sumObj = OutProducerFactory.createOutProducer(param);
                sumObj.initialize(entry, true);
                sumObj.summary(entry);

                continue;
            }

            System.out.println("Creating: " + tCase.getObjectName());

            LogWriter log = (LogWriter) dcl.getInstance(
                                    (String) param.get("LogWriter"));
            log.initialize(entry, true);
            entry.UserDefinedParams = param;
            tCase.setLogWriter((PrintWriter) log);

            try {
                tCase.initializeTestCase(param);
            } catch (RuntimeException e) {
                helper.ProcessHandler ph = (helper.ProcessHandler) param.get(
                                                   "AppProvider");

                if (ph != null) {
                    OfficeWatcher ow = (OfficeWatcher) param.get("Watcher");

                    if ((ow != null) && ow.isAlive()) {
                        ow.finish = true;
                    }

                    ph.kill();
                    shortWait(5000);
                }

                continue;
            }

            TestEnvironment tEnv = tCase.getTestEnvironment(param);

            if (tEnv == null) {
                sumIt.summarizeDown(entry, "Unable to create testcase");

                LogWriter sumObj = OutProducerFactory.createOutProducer(param);
                sumObj.initialize(entry, true);
                sumObj.summary(entry);

                helper.ProcessHandler ph = (helper.ProcessHandler) param.get(
                                                   "AppProvider");

                if (ph != null) {
                    OfficeWatcher ow = (OfficeWatcher) param.get("Watcher");

                    if ((ow != null) && ow.isAlive()) {
                        ow.finish = true;
                    }

                    ph.kill();
                    shortWait(5000);
                }

                continue;
            }

            System.out.println("created " + tCase.getObjectName());

            for (int j = 0; j < entry.SubEntryCount; j++) {
                if (!entry.SubEntries[j].isToTest) {
                    Summarizer.summarizeDown(entry.SubEntries[j],
                                             "not part of the job");

                    continue;
                }

                if ((exclusions != null) &&
                        (exclusions.contains(entry.SubEntries[j].longName))) {
                    Summarizer.summarizeDown(entry.SubEntries[j],
                                             "known issue");

                    continue;
                }

                System.out.println("running: " +
                                   entry.SubEntries[j].entryName);

                LogWriter ifclog = (LogWriter) dcl.getInstance(
                                           (String) param.get("LogWriter"));
                ifclog.initialize(entry.SubEntries[j], true);
                entry.SubEntries[j].UserDefinedParams = param;
                entry.SubEntries[j].Logger = ifclog;

                if ((tEnv == null) || tEnv.isDisposed()) {
                    helper.ProcessHandler ph = (helper.ProcessHandler) param.get(
                                                       "AppProvider");

                    if (ph != null) {
                        office.closeExistingOffice(param, true);
                        shortWait(5000);
                    }

                    tEnv = getEnv(entry, param);
                }

                BasicIfcTest ifc = null;
                lib.TestResult res = null;
                ifc = new BasicIfcTest(entry.SubEntries[j].longName);
                res = ifc.run(entry.SubEntries[j], tEnv, param);

                sumIt.summarizeUp(entry.SubEntries[j]);

                LogWriter sumIfc = OutProducerFactory.createOutProducer(param);

                sumIfc.initialize(entry.SubEntries[j], true);
                sumIfc.summary(entry.SubEntries[j]);
            }

            try {
                tCase.cleanupTestCase(param);
            } catch (Exception e) {
                log.println("TestCase already gone");

                helper.ProcessHandler ph = (helper.ProcessHandler) param.get(
                                                   "AppProvider");

                if (ph != null) {
                    office.closeExistingOffice(param, true);
                    shortWait(5000);
                }
            }

            sumIt.summarizeUp(entry);

            LogWriter sumObj = OutProducerFactory.createOutProducer(param);
            sumObj.initialize(entry, true);
            sumObj.summary(entry);
        }

        if (entries.length > 1) {
            System.out.println();

            int counter = 0;
            System.out.println(
                    "Failures that appeared during scenario execution:");

            for (int i = 0; i < entries.length; i++) {
                if (!entries[i].State.endsWith("OK")) {
                    System.out.println("\t " + entries[i].longName);
                    counter++;
                }
            }

            System.out.println(counter + " of " + entries.length +
                               " tests failed");
        }

        helper.ProcessHandler ph = (helper.ProcessHandler) param.get(
                                           "AppProvider");

        if (ph != null) {
            office.closeExistingOffice(param, true);
        }

        return true;
    }
View Full Code Here

Examples of helper.OfficeProvider

            // we don't need to start a new office.
            GraphicalTestArguments aGTA = getGraphicalTestArguments();
            if (GraphicalDifferenceCheck.isReferenceExists(_sInputPath, _sReferencePath, aGTA) == false)
            {
            // start a fresh Office
                OfficeProvider aProvider = null;
                // SimpleFileSemaphore aSemaphore = new SimpleFileSemaphore();
                if (aGTA.shouldOfficeStart())
                {
                    // if (OSHelper.isWindows())
                    // {
                    //     aSemaphore.P(aSemaphore.getSemaphoreFile());
                    // }
                    aGTA.getPerformance().startTime(PerformanceContainer.OfficeStart);
                    aProvider = new OfficeProvider();
                    XMultiServiceFactory xMSF = (XMultiServiceFactory) aProvider.getManager(param);
                    param.put("ServiceFactory", xMSF);
                    aGTA.getPerformance().stopTime(PerformanceContainer.OfficeStart);

                    long nStartTime = aGTA.getPerformance().getTime(PerformanceContainer.OfficeStart);
                    aGTA = getGraphicalTestArguments();
                    aGTA.getPerformance().setTime(PerformanceContainer.OfficeStart, nStartTime);
                }
               
                // Watcher Object is need in log object to give a simple way to say if a running office is alive.
                // As long as a log comes, it pings the Watcher and says the office is alive, if not an
                // internal counter increase and at a given point (300 seconds) the office is killed.
                GlobalLogWriter.get().println("Set office watcher");
                Object aWatcher = param.get("Watcher");
                GlobalLogWriter.get().setWatcher(aWatcher);
                // initializeWatcher(param);

                try
                {
                    log.println("Reference type is " + aGTA.getReferenceType());
                    DB.source_start();
                    GraphicalDifferenceCheck.createOneReferenceFile(_sInputPath, _sReferencePath, aGTA);
                    DB.source_finished();
                }
                catch(ConvWatchCancelException e)
                {
                    assure(e.getMessage(), false);
                    DB.source_failed(e.getMessage());
                }
                catch(ConvWatchException e)
                {
                    assure(e.getMessage(), false);
                    DB.source_failed(e.getMessage());
                }
                catch(com.sun.star.lang.DisposedException e)
                {
                    assure(e.getMessage(), false, true);
                    DB.source_failed(e.getMessage());
                }
               
                // Office shutdown
                if (aProvider != null)
                {
                    boolean bClosed = aProvider.closeExistingOffice(param, true);
                    // Hope I can check that the close of the office fails
                    assure("Office closed", bClosed, true);
                    // if (OSHelper.isWindows())
                    // {
                    //     aSemaphore.V(aSemaphore.getSemaphoreFile());
View Full Code Here

Examples of helper.OfficeProvider

            param.put("TimeOut", new Integer(300000));
            System.out.println("TimeOut: " + param.getInt("TimeOut"));
            System.out.println("ThreadTimeOut: " + param.getInt("ThreadTimeOut"));

            // OfficeProvider aProvider = null;
            m_aProvider = new OfficeProvider();
            m_xXMultiServiceFactory = (XMultiServiceFactory) m_aProvider.getManager(param);
            param.put("ServiceFactory", m_xXMultiServiceFactory);
        }
View Full Code Here

Examples of helper.OfficeProvider

            param.put("TimeOut", new Integer(300000));
            System.out.println("TimeOut: " + param.getInt("TimeOut"));
            System.out.println("ThreadTimeOut: " + param.getInt("ThreadTimeOut"));

            // OfficeProvider aProvider = null;
            m_aProvider = new OfficeProvider();
            m_xXMultiServiceFactory = (XMultiServiceFactory) m_aProvider.getManager(param);
            param.put("ServiceFactory", m_xXMultiServiceFactory);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.