Soapui PRO project solution collection-custom project and Setup

Source: Internet
Author: User
Tags soapui wsdl
import java.util.List;import java.util.Map;import org.apache.log4j.Logger;import com.eviware.soapui.SoapUI;import com.eviware.soapui.SoapUIProSettings;import com.eviware.soapui.impl.wsdl.WsdlProjectPro;import com.eviware.soapui.impl.wsdl.support.connections.DatabaseConnection;import com.eviware.soapui.impl.wsdl.support.connections.DefaultDatabaseConnectionContainer;import com.eviware.soapui.model.environment.Environment;import com.eviware.soapui.model.project.Project;import com.eviware.soapui.model.settings.Settings;import com.eviware.soapui.model.testsuite.TestSuite;import com.eviware.soapui.settings.HttpSettings;import com.eviware.soapui.settings.ProxySettings;import com.eviware.soapui.support.GroovyUtils;public class ProjectLevel {                    public void mypro(Project project,Logger log){                                project.getProperties().clear();                project.setPropertyValue("", "");                        GroovyUtils.registerJdbcDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");        //        project.getPropertyAt(1).getName(),get the soapui project level from API.                      if(project instanceof WsdlProjectPro){            //properties for project            String name = project.getName();            String description = project.getDescription();                        String path = project.getPath();            String resourceRoot = project.getResourceRoot();            ((WsdlProjectPro) project).setComposite(true);            project.getShadowPassword();            ((WsdlProjectPro) project).getScriptLibrary();            ((WsdlProjectPro) project).getDefaultScriptLanguage();            ((WsdlProjectPro) project).setCacheDefinitions(true);                                    //custom properties before setup the soapui project                        //testsuite            int testSuiteCount = project.getTestSuiteCount();            TestSuite testSuiteByName = project.getTestSuiteByName("");            List<TestSuite> testSuiteList = project.getTestSuiteList();            Map<String, TestSuite> testSuites = ((WsdlProjectPro) project).getTestSuites();                                    for(TestSuite suite:testSuiteList){                String name2 = suite.getName();                            }                        for(String key:testSuites.keySet()){                TestSuite value = testSuites.get(key);                        }                                    //configuration jdbc connections            GroovyUtils.registerJdbcDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");                        DefaultDatabaseConnectionContainer databaseConnectionContainer = ((WsdlProjectPro) project).getDatabaseConnectionContainer();            String[] databaseConnectionsNames = databaseConnectionContainer.getDatabaseConnectionsNames(com.eviware.soapui.model.environment.DefaultEnvironment.getInstance());            for(String dbname:databaseConnectionsNames){                databaseConnectionContainer.removeDatabaseConnectionByName(dbname);            }                        DatabaseConnection addDatabaseConnection = databaseConnectionContainer.addDatabaseConnection("com.microsoft.sqlserver.jdbc.SQLServerDriver");            addDatabaseConnection.setDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");            addDatabaseConnection.setConnectionString("jdbc:sqlserver://GDCQA4-SQL01;databaseName=QA4;user=qa_automation;password=Gr33nDot!");            addDatabaseConnection.setName("testname");            addDatabaseConnection.setPassword("");                                                int projectCount = project.getWorkspace().getProjectCount();                        //environment settings ,we can mark testing with different environments ,refer this url            //http://www.soapui.org/Working-with-Projects/environment-handling-in-soapui.html             String activeEnvironmentName = ((WsdlProjectPro) project).getActiveEnvironmentName();            ((WsdlProjectPro) project).setActiveEnvironment("staging");                        ((WsdlProjectPro) project).getEnvironmentList().clear();            List<Environment> environmentList = ((WsdlProjectPro) project).getEnvironmentList();            for(Environment e:environmentList){                                String project2 = e.getProject().getName();                String name2 = e.getName();                e.addNewProperty("propertyname","propertyvlaue");                e.addNewService("testservice", null);            }                        //soapui preference global settings, like the http settings,proxy settings and so on             Settings settings = SoapUI.getSettings();                        settings.setString(ProxySettings.ENABLE_PROXY, "false");            settings.setString(HttpSettings.HTTP_VERSION, "1.1");            settings.setString(SoapUIProSettings.OUTLINE_EDITOR_LIMIT, "4000000");            settings.setString(SoapUIProSettings.FORM_EDITOR_LIMIT, "200000");                        settings.setString(SoapUIProSettings.SCRIPT_LIBRARY, "C:\\TEST\\groovy");            settings.setString(SoapUIProSettings.COMPLETE_MESSAGE_LOGS,"true");                        SoapUI.updateProxyButtonAndTooltip();            SoapUI.updateProxyFromSettings();            settings.reloadSettings();                                    //set the event                                            }

Soapui PRO project solution collection-custom project and Setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.