Author: richard.opalka(a)jboss.com
Date: 2007-12-04 11:52:06 -0500 (Tue, 04 Dec 2007)
New Revision: 5179
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/Constant.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/Util.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/config/Request.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/config/RequestImpl.java
stack/native/trunk/src/test/resources/jaxws/wsrm/emulator/reqres/config/req-res-service-config.xml
Log:
extend emulator functionality - enable matching by element content
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/Constant.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/Constant.java 2007-12-04
15:36:04 UTC (rev 5178)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/Constant.java 2007-12-04
16:52:06 UTC (rev 5179)
@@ -59,6 +59,7 @@
public static final String NODE_ELEMENT = "node";
public static final String ID_ATTRIBUTE = "id";
public static final String NAME_ATTRIBUTE = "name";
+ public static final String EQUALS_ATTRIBUTE = "equals";
public static final String RESOURCE_ATTRIBUTE = "resource";
public static final String STATUS_CODE_ATTRIBUTE = "statusCode";
public static final String CONTENT_TYPE_ATTRIBUTE = "contentType";
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/Util.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/Util.java 2007-12-04
15:36:04 UTC (rev 5178)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/Util.java 2007-12-04
16:52:06 UTC (rev 5179)
@@ -210,14 +210,19 @@
public static boolean matches(Document req, View view)
{
- List<String> matches = view.getRequest().getMatches();
+ Map<String, String> matches = view.getRequest().getMatches();
if ((matches == null) || (matches.size() == 0))
return true;
boolean match = true;
- for (String matchString : matches)
+ for (String matchString : matches.keySet())
{
match = match && elementExists(req, matchString);
+ String equalsValue = matches.get(matchString);
+ if (match && (null != equalsValue) &&
(!"".equals(equalsValue)))
+ {
+ match = match && equalsValue.equals(getElement(req,
matchString).getTextContent());
+ }
}
return match;
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/config/Request.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/config/Request.java 2007-12-04
15:36:04 UTC (rev 5178)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/config/Request.java 2007-12-04
16:52:06 UTC (rev 5179)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.ws.jaxws.wsrm.emulator.config;
-import java.util.List;
import java.util.Map;
/**
@@ -35,6 +34,6 @@
{
String getHttpMethod();
String getPathInfo();
- List<String> getMatches();
+ Map<String, String> getMatches();
Map<String, String> getProperties();
}
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/config/RequestImpl.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/config/RequestImpl.java 2007-12-04
15:36:04 UTC (rev 5178)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/emulator/config/RequestImpl.java 2007-12-04
16:52:06 UTC (rev 5179)
@@ -46,7 +46,7 @@
private final String httpMethod;
private final String pathInfo;
private final Map<String, String> properties;
- private final List<String> matches;
+ private final Map<String, String> matches;
RequestImpl(Element e, Map<String, String> namespaces)
{
@@ -56,17 +56,18 @@
if ((contains != null) && (contains.getLength() == 1))
{
NodeList nodes =
((Element)contains.item(0)).getElementsByTagName(NODE_ELEMENT);
- List<String> toFill = new LinkedList<String>();
- this.matches = Collections.unmodifiableList(toFill);
+ Map<String, String> toFill = new HashMap<String, String>();
+ this.matches = Collections.unmodifiableMap(toFill);
for (int i = 0; i < nodes.getLength(); i++)
{
String nameAttrValue =
((Element)nodes.item(i)).getAttribute(NAME_ATTRIBUTE);
- toFill.add(Util.replaceAll(nameAttrValue, namespaces));
+ String equalsAttrValue =
((Element)nodes.item(i)).getAttribute(EQUALS_ATTRIBUTE);
+ toFill.put(Util.replaceAll(nameAttrValue, namespaces), equalsAttrValue);
}
}
else
{
- this.matches = Collections.emptyList();
+ this.matches = Collections.emptyMap();
}
NodeList setNodes = e.getElementsByTagName(SET_ELEMENT);
if ((setNodes != null) && (setNodes.getLength() > 0))
@@ -91,7 +92,7 @@
return this.httpMethod;
}
- public final List<String> getMatches()
+ public final Map<String, String> getMatches()
{
return this.matches;
}
Modified:
stack/native/trunk/src/test/resources/jaxws/wsrm/emulator/reqres/config/req-res-service-config.xml
===================================================================
---
stack/native/trunk/src/test/resources/jaxws/wsrm/emulator/reqres/config/req-res-service-config.xml 2007-12-04
15:36:04 UTC (rev 5178)
+++
stack/native/trunk/src/test/resources/jaxws/wsrm/emulator/reqres/config/req-res-service-config.xml 2007-12-04
16:52:06 UTC (rev 5179)
@@ -54,6 +54,9 @@
<request httpMethod="POST" pathInfo="/ReqResService">
<contains>
<node
name="|{${soap}}Envelope|{${soap}}Header|{${wsrm}}SequenceAcknowledgement"/>
+ <node
+ name="|{${soap}}Envelope|{${soap}}Header|{${wsa}}Action"
+
equals="http://docs.oasis-open.org/ws-rx/wsrm/200702/SequenceAcknowl...
</contains>
</request>
<response statusCode="200"/>