SoapUI Pro Project Solution Collection-Custom project and setup

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 

        }
时间: 2024-10-17 02:31:03

SoapUI Pro Project Solution Collection-Custom project and setup的相关文章

SoapUI Pro Project Solution Collection &ndash;Easy develop Groovy Script to improve SoapUI ability

As you know the groovy script and java script language is the soapui supported .but unfortunately Soapui's groovy editor had not provided a better editor to write the groovy script. there are two approaches you can take to write your own groovy scrip

SoapUI Pro Project Solution Collection-access the soapui object

Technorati 标签: Soapui pro,web service,apI Testing

将Maven的Java Project修改为Web Project

将Maven的Java  Project修改为Web Project关键是需要了解Eclipse和MyEclipse的工程中如下文件.classpath和.project和.mymetadata含义和作用. .project文件,本文主题将Maven的Java  Project改为Web Project,关键是如下配置: <?xml version="1.0"encoding="UTF-8"?> <?xml version="1.0&qu

从 Project Professional 中登录 Project Server

您必须使用 Project Server 2007 或 Project Server 2010 帐户才能登录到 Project Server2010.当您具备有效帐户后,只需启动 Project Professional 2010 并在"登录"对话框中输入用户名和密码即可. 注释    尝试连接到 Project Server 时,如果收到"Project Server 不可用"消息,请与您的服务器管理员进行核实,确定自己是否属于有权从 Project 登录的 Pr

SoapUI Pro Project Solution Collection-DataSource(jdbc,excel)

here give a solution for excel file change the excel configuration these: Set Excel file path in current project location: ${projectDir}//Projectname//your excel file name Excel Worksheet,Start at cell,Ignore Empty:

SoapUI Pro Project Solution Collection-XML assert

in soapui the XML object used here is from  org.w3c.dom package so you need to read this article carefully before we can use xml object very well. http://www.w3schools.com/dom/ http://www.w3schools.com/dom/dom_nodetype.asp Node Types - Return Values

SoapUI Pro Project Solution Collection-change the JDBC Request behavior

change the jdbc request : 1.change the driver name,connection string,query string or assert. the object we will use here is : JdbcRequestTestStep TestCase newcase=testRunner.getTestCase(); JdbcRequestTestStep step1=(JdbcRequestTestStep) newcase.getTe

Microsoft Office 2016 简体中文 Vol 版镜像下载(Pro Plus、Visio、Project 下载)

在使用上,零售版和批量授权版并没有区别,只是授权方式方面的区别,相对而言,VOL 版的更容易激活一些,其他并没有什么区别了. 有需要的可以在下面下载:(以下均是 VL 版) 版本:Office 2016 Pro Plus  64 位 文件名:SW_DVD5_Office_Professional_Plus_2016_64Bit_ChnSimp_MLF_X20-42426.ISO 文件大小: 1123452928 字节 MD5: 60DC8B1892F611E41140DD3631F39793 S

【转载】解决refreshing gradle project 和Building gradle project info 一直卡住\速度慢

转载: http://blog.csdn.net/xx326664162/article/details/52002616 文章出自:薛瑄的博客 分析原因: 更改Gradle的版本后,或者更新AS后,再次打开Android studio 会根据指定的url去Gradle官网下载新版文件,所需时间过长,很大可能下载不成功,一直卡在Building gradle project info或refreshing gradle project这一步(解决方法见下). 你可能会有疑问,为什么有时候更新AS