Package util

Examples of util.DynamicClassLoader


        return true;
    }

    protected TestEnvironment getEnv(DescEntry entry, TestParameters param) {
        DynamicClassLoader dcl = new DynamicClassLoader();
        String officeProviderName = (String) param.get("OfficeProvider");
        AppProvider office = (AppProvider) dcl.getInstance(officeProviderName);

        if (office == null) {
            System.out.println("ERROR: Wrong parameter 'OfficeProvider', " +
                               " it cannot be instantiated.");
            System.exit(-1);
        }

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

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

        param.put("ServiceFactory", msf);

        TestCase tCase = (TestCase) new BasicTestCase(entry);

        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);
View Full Code Here


    public static boolean logging = true;
    public static boolean newOffice = false;
    private DynamicClassLoader dcl = null;

    public boolean executeTest(lib.TestParameters param) {
        dcl = new DynamicClassLoader();

        DescGetter dg = new APIDescGetter();
        String job = (String) param.get("TestJob");
        String ExclusionFile = (String) param.get("ExclusionList");
        Vector exclusions = null;
View Full Code Here

    }

    private AppProvider startOffice(lib.TestParameters param) {

        if (dcl == null) {
            dcl = new DynamicClassLoader();
        }

        String officeProviderName = (String) param.get("OfficeProvider");
        AppProvider office = (AppProvider) dcl.getInstance(officeProviderName);
View Full Code Here

    if (complexIniFileName != null) {
          CfgParser ini = new CfgParser(complexIniFileName);
          ini.getIniParameters(param);
    }

        DynamicClassLoader dcl = new DynamicClassLoader();
        ComplexTestCase testClass = null;
        boolean returnVal = true;
       
//        the concept of the TimeOut depends on runner logs. If the runner log,
//        for exmaple to start a test method, the timeout was restet. This is not
//        while the test itself log something like "open docuent...".
//        An property of complex test could be that it have only one test method
//        which works for serveral minutes. Ih this case the TimeOut get not trigger
//        and the office was killed.
//        In complex tests just use "ThreadTimeOut" as timout.
       
        // param.put("TimeOut", new Integer(0));

        for (int i=0; i<entries.length; i++) {

            if (entries[i] == null) continue;
            String iniName = entries[i].longName;
            iniName = iniName.replace('.', '/');
          CfgParser ini = new CfgParser(iniName+".props");
          ini.getIniParameters(param);

            LogWriter log = (LogWriter)dcl.getInstance(
                                                (String)param.get("LogWriter"));

            AppProvider office = null;
            if (!param.getBool("NoOffice")) {
                try {
                    office = (AppProvider)dcl.getInstance("helper.OfficeProvider");
                    Object msf = office.getManager(param);
                    if (msf == null) {
                        returnVal = false;
                        continue;
                    }
                    param.put("ServiceFactory",msf);
                }
                catch(IllegalArgumentException e) {
                    office = null;
                }
            }
            log.initialize(entries[i],param.getBool(PropertyName.LOGGING_IS_ACTIVE));
            entries[i].Logger = log;

            // create an instance
            try {
                testClass = (ComplexTestCase)dcl.getInstance(entries[i].longName);
            }
            catch(java.lang.Exception e) {
                e.printStackTrace();
                return false;
            }
View Full Code Here

                    System.out.println(errorMessage);
                    return null;
                }
                bAppExecutionHasWarning = !errorMessage.equals("OK");

                DynamicClassLoader dcl = new DynamicClassLoader();
                LogWriter log = (LogWriter) dcl.getInstance(
                (String) param.get("LogWriter"));
               
                //create empty entry
                DescEntry Entry = new DescEntry();
                Entry.entryName = "office";
View Full Code Here

        return null;
    }

       
    protected DescEntry getDescriptionForSingleJob(String className, String descPath, boolean debug) {
        DynamicClassLoader dcl = new DynamicClassLoader();
        String methodNames[] = null;

        if (debug) {
            System.out.println("Searching Class: " + className);
        }

        int index = className.indexOf("::");
        if (index != -1) {
            String method = className.substring(index + 2);
            className = className.substring(0, index);
            Vector methods = new Vector();
            StringTokenizer t = new StringTokenizer(method, ",");
            while (t.hasMoreTokens()) {
                String m = t.nextToken();
                if (m.endsWith("()"))
                    m = m.substring(0, m.length() - 2);
                methods.add(m);
            }
            methodNames = new String[methods.size()];
            methodNames = (String[])methods.toArray(methodNames);
        }
           
        // create an instance
        try {
            testClass = (ComplexTestCase)dcl.getInstance(className);
        }
        catch(java.lang.IllegalArgumentException e) {
            System.out.println("Error while getting description for test '" +className + "' as a Complex test.");
            return null;
        }
View Full Code Here

                    System.out.println(errorMessage);
                    return null;
                }
                bAppExecutionHasWarning = !errorMessage.equals("OK");

                final DynamicClassLoader dcl = new DynamicClassLoader();
                final LogWriter log = (LogWriter) dcl.getInstance(
                        (String) param.get("LogWriter"));

                //create empty entry
                final DescEntry Entry = new DescEntry();
                Entry.entryName = "office";
View Full Code Here

            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;
View Full Code Here

        return true;
    }

    protected TestEnvironment getEnv(DescEntry entry, TestParameters param)
    {
        DynamicClassLoader dcl = new DynamicClassLoader();
        String officeProviderName = (String) param.get("OfficeProvider");
        AppProvider office = (AppProvider) dcl.getInstance(officeProviderName);

        if (office == null)
        {
            System.out.println("ERROR: Wrong parameter 'OfficeProvider', " +
                    " it cannot be instantiated.");
            System.exit(-1);
        }

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

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

        param.put("ServiceFactory", msf);

        TestCase tCase = (TestCase) new BasicTestCase(entry);

        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);
View Full Code Here

        return null;
    }

    protected DescEntry getDescriptionForSingleJob(String className, String descPath, boolean debug)
    {
        DynamicClassLoader dcl = new DynamicClassLoader();
        String methodNames[] = null;

        if (debug)
        {
            System.out.println("Searching Class: " + className);
        }

        int index = className.indexOf("::");
        if (index != -1)
        {
            // case1: method()
            // case2: method(param1,param2)
            // case3: method1(param1,param2),method2(param1,param2)
            String method = className.substring(index + 2);
            className = className.substring(0, index);
            Vector methods = new Vector();

            String[] split = method.split("(?<=\\)),(?=\\w+)");

            for (int i = 0; i < split.length; i++)
            {
                String meth = split[i];

                if (meth.endsWith("()"))
                {
                    meth = meth.substring(0, meth.length() - 2);
                }

                methods.add(meth);
            }

            methodNames = new String[methods.size()];
            methodNames = (String[]) methods.toArray(methodNames);
        }

        // create an instance
        try
        {
            testClass = (ComplexTestCase) dcl.getInstance(className);
        }
        catch (java.lang.IllegalArgumentException e)
        {
            System.out.println("Error while getting description for test '" + className + "' as a Complex test.");
            return null;
View Full Code Here

TOP

Related Classes of util.DynamicClassLoader

Copyright © 2018 www.massapicom. 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.