本文整理汇总了Java中com.eviware.soapui.support.StringUtils类的典型用法代码示例。如果您正苦于以下问题:Java StringUtils类的具体用法?Java StringUtils怎么用?Java StringUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringUtils类属于com.eviware.soapui.support包,在下文中一共展示了StringUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: execute
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
@Override
public Object execute() {
Class clazz;
try{
clazz = Class.forName("com.eviware.soapui.impl.wsdl.teststeps.assertions.EqualsAssertion");
Field labelField = clazz.getField("LABEL");
TestAssertion assertion = assertable.addAssertion((String) labelField.get(null));
if (clazz.isInstance(assertion)) {
Method method = clazz.getMethod("setPatternText", String.class);
method.invoke(assertion, StringUtils.unquote(StringEscapeUtils.unescapeJava(value)));
}
}
catch (Throwable e){
logger.warn("Creating EqualsAssertion is only supported in ReadyAPI", e);
}
return null;
}
开发者ID:SmartBear,项目名称:readyapi-postman-plugin,代码行数:18,代码来源:AddEqualsAssertionCommand.java
示例2: convertParameters
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
private void convertParameters(RestParamsPropertyHolder propertyHolder) {
for (TestProperty property : propertyHolder.getPropertyList()) {
if (property instanceof RestParamProperty && ((RestParamProperty) property).getStyle() == ParameterStyle.TEMPLATE) {
property.setValue("{{" + property.getName() + "}}");
}
String convertedValue = VariableUtils.convertVariables(property.getValue());
property.setValue(convertedValue);
if (property instanceof RestParamProperty && StringUtils.hasContent(property.getDefaultValue())) {
if (((RestParamProperty) property).getStyle() == ParameterStyle.TEMPLATE) {
((RestParamProperty) property).setDefaultValue("{{" + property.getName() + "}}");
}
convertedValue = VariableUtils.convertVariables(property.getDefaultValue());
((RestParamProperty) property).setDefaultValue(convertedValue);
}
}
}
开发者ID:SmartBear,项目名称:readyapi-postman-plugin,代码行数:18,代码来源:PostmanImporter.java
示例3: formOutcome
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
private String formOutcome(ExecutableTestStepResult executionResult){
if(executionResult.getStatus() == TestStepResult.TestStepStatus.CANCELED){
return "CANCELED";
}
else {
if(getReceivedMessageTopic() == null){
if(executionResult.getError() == null){
return "Unable to receive a message (" + StringUtils.join(executionResult.getMessages(), " ") + ")";
}
else{
return "Error during message receiving: " + Utils.getExceptionMessage(executionResult.getError());
}
}
else{
return String.format("Message with %s topic has been received within %d ms", getReceivedMessageTopic(), executionResult.getTimeTaken());
}
}
}
开发者ID:SmartBear,项目名称:ready-mqtt-plugin,代码行数:20,代码来源:ReceiveTestStep.java
示例4: checkProperties
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
private boolean checkProperties(WsdlTestStepResult result, String topicToCheck, PublishedMessageType messageTypeToCheck, String messageToCheck) {
boolean ok = true;
if(StringUtils.isNullOrEmpty(topicToCheck)){
result.addMessage("The topic of message is not specified");
ok = false;
}
if(messageTypeToCheck == null){
result.addMessage("The message format is not specified.");
ok = false;
}
if(StringUtils.isNullOrEmpty(messageToCheck) && (messageTypeToCheck != PublishedMessageType.Utf16Text) && (messageTypeToCheck != PublishedMessageType.Utf8Text)){
if(messageTypeToCheck == PublishedMessageType.BinaryFile) result.addMessage("A file which contains a message is not specified"); else result.addMessage("A message content is not specified.");
ok = false;
}
return ok;
}
开发者ID:SmartBear,项目名称:ready-mqtt-plugin,代码行数:18,代码来源:PublishTestStep.java
示例5: formOutcome
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
private String formOutcome(WsdlTestStepResult executionResult) {
switch (executionResult.getStatus()){
case CANCELED:
return "CANCELED";
case FAILED:
if(executionResult.getError() == null){
return "Unable to publish the message (" + StringUtils.join(executionResult.getMessages(), " ") + ")";
}
else{
return "Error during message publishing: " + Utils.getExceptionMessage(executionResult.getError());
}
default:
return String.format("The message has been published within %d ms", executionResult.getTimeTaken());
}
}
开发者ID:SmartBear,项目名称:ready-mqtt-plugin,代码行数:18,代码来源:PublishTestStep.java
示例6: grabConnections
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
private static ArrayList<Connection> grabConnections(Project project){
ArrayList<Connection> result = null;
String settingValue = project.getSettings().getString(CONNECTIONS_SETTING_NAME, "");
if(StringUtils.hasContent(settingValue)) {
XmlObject root = null;
try {
root = XmlObject.Factory.parse(settingValue);
}
catch (XmlException e) {
SoapUI.logError(e);
return result;
}
result = new ArrayList<Connection>();
XmlObject[] connectionSections = root.selectPath("$this/" + CONNECTION_SECTION_NAME);
for(XmlObject section : connectionSections){
Connection connection = new Connection();
connection.load(section);
result.add(connection);
}
}
return result;
}
开发者ID:SmartBear,项目名称:ready-mqtt-plugin,代码行数:23,代码来源:ConnectionsManager.java
示例7: checkServerUri
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
public static String checkServerUri(String serverUri) {
if (StringUtils.isNullOrEmpty(serverUri)) {
return "The Server URI is not specified for the connection.";
} else {
URI uri;
try {
uri = new URI(serverUri);
String protocol;
if(uri.getAuthority() == null){
uri = new URI("tcp://" + serverUri);
protocol = "tcp";
}
else{
protocol = uri.getScheme();
}
if(protocol != null && !areStringsEqual(protocol, "tcp", false) && !areStringsEqual(protocol, "ssl", false)){
return "The Server URI contains unknown protocol. Only \"tcp\" and \"ssl\" are allowed.";
}
if(!areStringsEqual(uri.getPath(), "")) return "The Server URI must not contain a path part.";
if(StringUtils.isNullOrEmpty(uri.getHost())) return "The string specified as Server URI is not a valid URI.";
} catch (URISyntaxException e) {
return "The string specified as Server URI is not a valid URI.";
}
}
return null;
}
开发者ID:SmartBear,项目名称:ready-mqtt-plugin,代码行数:27,代码来源:Utils.java
示例8: checkServerUri
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
public static String checkServerUri(String serverUri) {
if (StringUtils.isNullOrEmpty(serverUri))
return "The Server URI is not specified for the connection.";
else {
URI uri;
try {
uri = new URI(serverUri);
String protocol;
if (uri.getAuthority() == null) {
uri = new URI("ws://" + serverUri);
protocol = "ws";
} else
protocol = uri.getScheme();
if (protocol != null && !Utils.areStringsEqual(protocol, "ws", false)
&& !Utils.areStringsEqual(protocol, "wss", false))
return "The Server URI contains unknown protocol. Only \"ws\" and \"wss\" are allowed.";
if (StringUtils.isNullOrEmpty(uri.getHost()))
return "The Server URI contains no host.";
} catch (URISyntaxException e) {
return "The string specified as Server URI is not a valid URI.";
}
}
return null;
}
开发者ID:hschott,项目名称:ready-websocket-plugin,代码行数:25,代码来源:ConnectionParams.java
示例9: websocketException
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
public WebSocketException websocketException(final String message, final CloseReason closeReason) {
return new WebSocketException(message) {
@Override
public CloseReason getCloseReason() {
return closeReason;
}
@Override
public String toString() {
return getMessage()
+ " ["
+ closeReason.getCloseCode().getCode()
+ "] "
+ closeReason.getCloseCode()
+ (StringUtils.hasContent(closeReason.getReasonPhrase()) ? " '" + closeReason.getReasonPhrase()
+ "' " : "");
}
};
}
开发者ID:hschott,项目名称:ready-websocket-plugin,代码行数:21,代码来源:TyrusClient.java
示例10: propertyChange
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent event) {
super.propertyChange(event);
if (event.getPropertyName().equals("assertionStatus"))
updateStatusIcon();
else if (event.getPropertyName().equals("receivedMessage")) {
String msg = (String) event.getNewValue();
if (StringUtils.isNullOrEmpty(msg)) {
Utils.showMemo(recMessageMemo, true);
jsonEditor.setVisible(false);
xmlEditor.setVisible(false);
} else if (JsonUtil.seemsToBeJson(msg)) {
Utils.showMemo(recMessageMemo, false);
jsonEditor.setVisible(true);
xmlEditor.setVisible(false);
} else if (XmlUtils.seemsToBeXml(msg)) {
Utils.showMemo(recMessageMemo, false);
jsonEditor.setVisible(false);
xmlEditor.setVisible(true);
} else {
Utils.showMemo(recMessageMemo, true);
jsonEditor.setVisible(false);
xmlEditor.setVisible(false);
}
}
}
开发者ID:hschott,项目名称:ready-websocket-plugin,代码行数:27,代码来源:ReceiveTestStepPanel.java
示例11: checkProperties
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
private boolean checkProperties(WsdlTestStepResult result, PublishedMessageType messageTypeToCheck,
String messageToCheck) {
boolean ok = true;
if (messageTypeToCheck == null) {
result.addMessage("The message format is not specified.");
ok = false;
}
if (StringUtils.isNullOrEmpty(messageToCheck) && messageTypeToCheck != PublishedMessageType.Text) {
if (messageTypeToCheck == PublishedMessageType.BinaryFile)
result.addMessage("A file which contains a message is not specified");
else
result.addMessage("A message content is not specified.");
ok = false;
}
return ok;
}
开发者ID:hschott,项目名称:ready-websocket-plugin,代码行数:18,代码来源:PublishTestStep.java
示例12: grabConnections
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
private static ArrayList<Connection> grabConnections(Project project) {
ArrayList<Connection> result = null;
String settingValue = project.getSettings().getString(CONNECTIONS_SETTING_NAME, "");
if (StringUtils.hasContent(settingValue)) {
XmlObject root = null;
try {
root = XmlObject.Factory.parse(settingValue);
} catch (XmlException e) {
LOGGER.error(e);
return result;
}
result = new ArrayList<Connection>();
XmlObject[] connectionSections = root.selectPath("$this/" + CONNECTION_SECTION_NAME);
for (XmlObject section : connectionSections) {
Connection connection = new Connection();
connection.load(section);
result.add(connection);
}
}
return result;
}
开发者ID:hschott,项目名称:ready-websocket-plugin,代码行数:22,代码来源:ConnectionsManager.java
示例13: internalAssertResponse
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
@Override
protected String internalAssertResponse(MessageExchange messageExchange, SubmitContext submitContext) throws AssertionException {
try
{
String content = messageExchange.getResponse().getContentAsString();
if(StringUtils.isNullOrEmpty(content))
return "Response is empty - not a valid JSON response";
JSONSerializer.toJSON(messageExchange.getResponse().getContentAsString());
}
catch( Exception e )
{
throw new AssertionException( new AssertionError( "JSON Parsing failed; [" + e.toString() + "]" ));
}
return "Response is valid JSON";
}
开发者ID:olensmar,项目名称:soapui-plugin-template,代码行数:19,代码来源:SampleTestAssertionFactory.java
示例14: processElement
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
private void processElement( SchemaParticle sp, XmlCursor xmlc, boolean mixed )
{
// cast as schema local element
SchemaLocalElement element = ( SchemaLocalElement )sp;
// Add comment about type
addElementTypeAndRestricionsComment( element, xmlc );
// / ^ -> <elemenname></elem>^
if( _soapEnc )
xmlc.insertElement( element.getName().getLocalPart() ); // soap
// encoded?
// drop
// namespaces.
else
xmlc.insertElement( element.getName().getLocalPart(), element.getName().getNamespaceURI() );
// / -> <elem>^</elem>
// processAttributes( sp.getType(), xmlc );
xmlc.toPrevToken();
// -> <elem>stuff^</elem>
String[] values = null;
if( multiValues != null )
values = multiValues.get( element.getName() );
if( values != null )
xmlc.insertChars( StringUtils.join( values, "," ) );
else if( sp.isDefault() )
xmlc.insertChars( sp.getDefaultText() );
else
createSampleForType( element.getType(), xmlc );
// -> <elem>stuff</elem>^
xmlc.toNextToken();
}
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:35,代码来源:SampleXmlUtil.java
示例15: tokenize
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
public LinkedList<Token> tokenize(final String scriptToParse) throws SoapUIException {
LinkedList<Token> tokens = new LinkedList<>();
if (StringUtils.isNullOrEmpty(scriptToParse)) {
return tokens;
}
String script = scriptToParse.trim();
int nextTokenPosition = 0;
int lastTokenPosition = -1;
while (nextTokenPosition < script.length()) {
String remainedScript = script.substring(nextTokenPosition);
for (TokenType tokenType : TokenType.values()) {
Matcher matcher = tokenType.getPattern().matcher(remainedScript);
if (matcher.find()) {
lastTokenPosition = nextTokenPosition;
String sequence = matcher.group().trim();
tokens.add(new Token(tokenType, sequence));
nextTokenPosition = lastTokenPosition + matcher.end();
if (nextTokenPosition == lastTokenPosition) {
throw new SoapUIException("Unexpected character in input: " + script);
}
break;
}
}
}
return tokens;
}
开发者ID:SmartBear,项目名称:readyapi-postman-plugin,代码行数:32,代码来源:PostmanScriptTokenizer.java
示例16: execute
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
@Override
public Object execute() {
String propertyName = StringUtils.unquote(variableName.trim());
if (!project.hasProperty(propertyName)) {
TestProperty property = project.addProperty(propertyName);
property.setValue(StringUtils.unquote(variableValue));
}
return null;
}
开发者ID:SmartBear,项目名称:readyapi-postman-plugin,代码行数:11,代码来源:SetGlobalVariableCommand.java
示例17: execute
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
@Override
public Object execute() {
if (StringUtils.hasContent(condition)) {
if (condition.startsWith(NOT_EQUAL)) {
return addInvalidStatusAssertion();
}
}
return addValidStatusAssertion();
}
开发者ID:SmartBear,项目名称:readyapi-postman-plugin,代码行数:10,代码来源:AddHttpCodeAssertionCommand.java
示例18: addValidStatusAssertion
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
private Object addValidStatusAssertion() {
ValidHttpStatusCodesAssertion assertion = getValidHttpStatusCodesAssertion();
String codes = assertion.getCodes();
if (StringUtils.hasContent(codes)) {
assertion.setCodes(codes + "," + value);
} else {
assertion.setCodes(value);
}
return null;
}
开发者ID:SmartBear,项目名称:readyapi-postman-plugin,代码行数:11,代码来源:AddHttpCodeAssertionCommand.java
示例19: addInvalidStatusAssertion
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
private Object addInvalidStatusAssertion() {
InvalidHttpStatusCodesAssertion assertion = getInvalidHttpStatusCodesAssertion();
String codes = assertion.getCodes();
if (StringUtils.hasContent(codes)) {
assertion.setCodes(codes + "," + value);
} else {
assertion.setCodes(value);
}
return null;
}
开发者ID:SmartBear,项目名称:readyapi-postman-plugin,代码行数:11,代码来源:AddHttpCodeAssertionCommand.java
示例20: convertVariables
import com.eviware.soapui.support.StringUtils; //导入依赖的package包/类
public static String convertVariables(String postmanString) {
if (StringUtils.isNullOrEmpty(postmanString)) {
return postmanString;
}
final String POSTMAN_VARIABLE_BEGIN = "{{";
final String POSTMAN_VARIABLE_END = "}}";
final String ESCAPING_PREFIX = "\\";
final Pattern variableRegExp = Pattern.compile("\\{\\{.+\\}\\}");
StringBuffer readyApiStringBuffer = new StringBuffer();
Matcher matcher = variableRegExp.matcher(postmanString);
while (matcher.find()) {
String postmanVariable = matcher.group();
String readyApiVariable = postmanVariable
.replace(POSTMAN_VARIABLE_BEGIN, ESCAPING_PREFIX + READYAPI_VARIABLE_BEGIN)
.replace(POSTMAN_VARIABLE_END, READYAPI_VARIABLE_END);
matcher.appendReplacement(readyApiStringBuffer, readyApiVariable);
}
if (readyApiStringBuffer.length() > 0) {
matcher.appendTail(readyApiStringBuffer);
return readyApiStringBuffer.toString();
} else {
return postmanString;
}
}
开发者ID:SmartBear,项目名称:readyapi-postman-plugin,代码行数:28,代码来源:VariableUtils.java
注:本文中的com.eviware.soapui.support.StringUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论