本文整理汇总了Java中com.eviware.soapui.support.StringUtils类的典型用法代码示例。如果您正苦于以下问题:Java StringUtils类的具体用法?Java StringUtils怎么用?Java StringUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringUtils类属于com.eviware.soapui.support包,在下文中一共展示了StringUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
}
示例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());
}
}
}
示例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;
}
示例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());
}
}
示例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;
}
示例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;
}
示例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;
}
示例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()
+ "' " : "");
}
};
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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";
}
示例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();
}
示例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;
}