summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-03-16 10:18:40 (EST)
committer pelder2006-03-16 10:18:40 (EST)
commit0d883910a16b7cb69561d7b18bf30f3cc686d5eb (patch)
tree990f2737416ff0d03c7a2d39346ac3b8b6d798fe
parent8708c10a73accc0cea9592fc541831660c66c960 (diff)
downloadorg.eclipse.jet-0d883910a16b7cb69561d7b18bf30f3cc686d5eb.zip
org.eclipse.jet-0d883910a16b7cb69561d7b18bf30f3cc686d5eb.tar.gz
org.eclipse.jet-0d883910a16b7cb69561d7b18bf30f3cc686d5eb.tar.bz2
[132167] Add, implement and consume new INodeInspector method 'testExpandedName'.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/ast/NodeTest.java2
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/DOMInspector.java5
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EMFResourceInspector.java5
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EMFXMLNodeWrapperInspector.java8
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java15
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EStructuralFeatureSettingInspector.java5
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/INodeInspector.java91
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/AllTests.java34
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/EObjectInspectorTests.java48
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/SelfStepTests.java117
10 files changed, 302 insertions, 28 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/ast/NodeTest.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/ast/NodeTest.java
index cedf174..26c0aff 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/ast/NodeTest.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/ast/NodeTest.java
@@ -140,7 +140,7 @@ public abstract class NodeTest
Object obj = (Object)i.next();
INodeInspector inspector = inspectorMgr.getInspector(obj);
- if (inspector == null || inspector.getNodeKind(obj) != principalNodeKind || !testName.equals(inspector.expandedNameOf(obj)))
+ if (inspector == null || inspector.getNodeKind(obj) != principalNodeKind || !inspector.testExpandedName(obj, testName))
{
i.remove();
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/DOMInspector.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/DOMInspector.java
index e325752..a117940 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/DOMInspector.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/DOMInspector.java
@@ -379,4 +379,9 @@ public class DOMInspector implements INodeInspector, IElementInspector
element.removeAttribute(name);
}
+ public boolean testExpandedName(Object node, ExpandedName testName)
+ {
+ return testName.equals(expandedNameOf(node));
+ }
+
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EMFResourceInspector.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EMFResourceInspector.java
index 02216e3..f5142ff 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EMFResourceInspector.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EMFResourceInspector.java
@@ -127,4 +127,9 @@ public class EMFResourceInspector implements INodeInspectorExtension1, INodeInsp
return null;
}
+ public boolean testExpandedName(Object node, ExpandedName testName)
+ {
+ return testName.equals(expandedNameOf(node));
+ }
+
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EMFXMLNodeWrapperInspector.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EMFXMLNodeWrapperInspector.java
index ee20bc9..9d3f030 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EMFXMLNodeWrapperInspector.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EMFXMLNodeWrapperInspector.java
@@ -23,7 +23,7 @@ import org.eclipse.jet.xpath.inspector.INodeInspector;
/**
- * Inspect EMFXMLNodeWrapper objects.
+ * Inspect EMFXMLNodeWrapper objects. This wraps EMF nodes that represent COMMENT or TEXT nodes.
*
*/
public class EMFXMLNodeWrapperInspector implements INodeInspector
@@ -71,6 +71,7 @@ public class EMFXMLNodeWrapperInspector implements INodeInspector
*/
public ExpandedName expandedNameOf(Object object)
{
+ // comment and text nodes have no expanded name
return null;
}
@@ -98,4 +99,9 @@ public class EMFXMLNodeWrapperInspector implements INodeInspector
return null;
}
+ public boolean testExpandedName(Object node, ExpandedName testName)
+ {
+ return testName.equals(expandedNameOf(node));
+ }
+
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
index 49c0cea..5511569 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EObjectInspector.java
@@ -1058,4 +1058,19 @@ public class EObjectInspector implements IElementInspector, INodeInspectorExtens
}
}
+ public boolean testExpandedName(Object node, ExpandedName testName)
+ {
+ return testName.equals(expandedNameOf(node)) || testName.equals(eclassNameOf(node));
+ }
+
+ private ExpandedName eclassNameOf(Object node)
+ {
+ ExpandedName en = null;
+ if(getNodeKind(node) == NodeKind.ELEMENT)
+ {
+ en = new ExpandedName(((EObject)node).eClass().getName());
+ }
+ return en;
+ }
+
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EStructuralFeatureSettingInspector.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EStructuralFeatureSettingInspector.java
index 2da4bb4..d5c3e63 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EStructuralFeatureSettingInspector.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/inspectors/EStructuralFeatureSettingInspector.java
@@ -117,4 +117,9 @@ public class EStructuralFeatureSettingInspector implements INodeInspector
return setting.getEStructuralFeature().getName();
}
+ public boolean testExpandedName(Object node, ExpandedName testName)
+ {
+ return testName.equals(expandedNameOf(node));
+ }
+
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/INodeInspector.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/INodeInspector.java
index ad53cee..e3513c2 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/INodeInspector.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/inspector/INodeInspector.java
@@ -18,28 +18,80 @@ package org.eclipse.jet.xpath.inspector;
/**
- * Interface providing the XPath parser with information on a particular object.
- *
+ * Interface providing the XPath parser with information on a particular object. An inspector is specific
+ * to classes of a particular Java type. The inspector will only receive objects of the types for which it is registered.
+ * <p>
+ * Inspectors may be manually registered via {@link InspectorManager#registerInspector(Class[], Class)}, or via the
+ * <code>org.eclipse.jet.modelInsecptors</code> extension point.
+ * </p>
+ * <p>
+ * An inspector's responsibilies are
+ * <bl>
+ * <li>Map each received object to one of the XPath node kinds, as defined in {@link NodeKind}.
+ * For any given object, {@link #getNodeKind(Object)} should always return the same value.</li>
+ * <li>Implement the inspector functions consistently with the XPath 1.0 data model node to which the object is mapped.</li>
+ * </bl>
+ * </p>
+ * <p>
+ * An inspector may choose to implement the following extension interfaces:
+ * <bl>
+ * <li>{@link INodeInspectorExtension1} - to provide name-based searching of children. This optional extension may provide
+ * efficient resolution of name-based XPath navigations such as <code>$x/foo</code>.</li>
+ * <li>{@link IElementInspector} - provide extra information for objects that are mapped to XPath Elements. This interface must
+ * be implemented if the node inspector's implementation of {@link #getNodeKind(Object)} returns {@link NodeKind#ELEMENT}.
+ * </bl>
+ * </p>
*/
public interface INodeInspector
{
+ /**
+ * A type safe enumeration of node kinds recognized by the JET XPath engine.
+ */
public static final class NodeKind
{
private final String displayString;
+ /**
+ * A node that is the root of a document.
+ * See the XPath 1.0 Data Model <a href="http://www.w3.org/TR/xpath#root-node">Root Node</a>.
+ */
public static final NodeKind ROOT = new NodeKind("ROOT"); //$NON-NLS-1$
+ /**
+ * A node that is the element of a document.
+ * See the XPath 1.0 Data Model <a href="http://www.w3.org/TR/xpath#element-nodes">Element Nodes</a>.
+ */
public static final NodeKind ELEMENT = new NodeKind("ELEMENT"); //$NON-NLS-1$
+ /**
+ * A node that is an attribute of an element node.
+ * See the XPath 1.0 Data Model <a href="http://www.w3.org/TR/xpath#attribute-nodes">Attribute Nodes</a>.
+ */
public static final NodeKind ATTRIBUTE = new NodeKind("ATTRIBUTE"); //$NON-NLS-1$
+ /**
+ * A node that is identifies a namespace for an element node.
+ * See the XPath 1.0 Data Model <a href="http://www.w3.org/TR/xpath#namespace-nodes">Namespace Nodes</a>.
+ */
public static final NodeKind NAMESPACE = new NodeKind("NAMESPACE"); //$NON-NLS-1$
+ /**
+ * A node that contains textual information, which in turn is contained by an element node.
+ * See XPath 1.0 Data Model <a href="http://www.w3.org/TR/xpath#section-Text-Nodes">Text Nodes</a>
+ */
public static final NodeKind TEXT = new NodeKind("TEXT"); //$NON-NLS-1$
+ /**
+ * A node that contains processing instructions, and is contained by a root node or and element node.
+ * See XPath 1.0 Data model <a href="http://www.w3.org/TR/xpath#section-Processing-Instruction-Nodes">Processing Instruction Nodes</a>
+ */
public static final NodeKind PROCESSING_INSTRUCTION = new NodeKind("PROCESSING_INSTRUCTION"); //$NON-NLS-1$
+ /**
+ * A node that contains a document comment, and is contained by either a root node or an element node.
+ * See XPath 1.0 Data model <a href="http://www.w3.org/TR/xpath#section-Comment-Nodes">Comment Nodes</a>.
+ */
public static final NodeKind COMMENT = new NodeKind("COMMENT"); //$NON-NLS-1$
private NodeKind(String displayString)
@@ -67,24 +119,45 @@ public interface INodeInspector
*/
Object getParent(Object obj);
- String stringValueOf(Object object);
+ /**
+ * Return the string value of the passed node.
+ * @param node the node. Will not be <code>null</code>.
+ * @return the string value. Will not be <code>null</code>, but may be the empty string.
+ */
+ String stringValueOf(Object node);
- ExpandedName expandedNameOf(Object object);
+ /**
+ * Return the expanded name of the node.
+ * @param node a node from which an expanded name is sought
+ * @return an ExpandedName instance, or <code>null</code> if the node has not expanded name.
+ */
+ ExpandedName expandedNameOf(Object node);
/**
+ * Determine whether the name of the node matches the passed expanded name.
+ * @param testName an expanded name
+ * @return <code>true</code> if there is a match, <code>false</code> otherwise.
+ */
+ boolean testExpandedName(Object node, ExpandedName testName);
+ /**
* Return the document root for the contenxt node.
- * @param contextNode the context node. Will not be <code>null</code>.
+ * @param node the node. Will not be <code>null</code>.
* @return the document root, or <code>null</code> if a root cannot be determined.
*/
- Object getDocumentRoot(Object contextNode);
+ Object getDocumentRoot(Object node);
- Object[] getChildren(Object contextNode);
+ /**
+ * Return the child nodes of the context node.
+ * @param node the node. Will not be <code>null</code>.
+ * @return a possibly empty array of objects. Will not be <code>null</code>.
+ */
+ Object[] getChildren(Object node);
/**
* Return the 'name' of the node.
- * @param contextNode
+ * @param node
* @return the 'name' of the node, of <code>null</code> if the node has no name.
*/
- String nameOf(Object contextNode);
+ String nameOf(Object node);
}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/AllTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/AllTests.java
index de9fbff..1dbb92a 100644
--- a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/AllTests.java
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/AllTests.java
@@ -6,33 +6,33 @@ import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
- TestSuite suite = new TestSuite(
- "Test for org.eclipse.jet.tests.xpath");
+ TestSuite suite = new TestSuite("Test for org.eclipse.jet.tests.xpath");
//$JUnit-BEGIN$
- suite.addTestSuite(StringFunctionTests.class);
suite.addTestSuite(AttributeStepTests.class);
- suite.addTestSuite(RelOpTests.class);
- suite.addTestSuite(BooleanFunctionTests.class);
- suite.addTestSuite(BuiltinStringFunctionsTests.class);
+ suite.addTestSuite(XPathOverDOMTests.class);
+ suite.addTestSuite(StringFunctionTests.class);
+ suite.addTestSuite(ResourceInspectorTests.class);
suite.addTestSuite(XPathOverEmfXmlXsdTests.class);
- suite.addTestSuite(EStructuralFeatureSettingTests.class);
+ suite.addTestSuite(BooleanFunctionTests.class);
+ suite.addTestSuite(RelOpTests.class);
suite.addTestSuite(XPathParserTests.class);
- suite.addTestSuite(ChildStepTests.class);
- suite.addTestSuite(XPathInspectorManagerTests.class);
+ suite.addTestSuite(ExpandedNameTests.class);
+ suite.addTestSuite(XPathTokenScannerTests.class);
suite.addTestSuite(NumberFunctionTests.class);
+ suite.addTestSuite(NumberBinaryOpTests.class);
+ suite.addTestSuite(SelfStepTests.class);
+ suite.addTestSuite(BuiltinStringFunctionsTests.class);
+ suite.addTestSuite(XPathInspectorManagerTests.class);
+ suite.addTestSuite(EObjectInspectorTests.class);
suite.addTestSuite(DOMInspectorTests.class);
- suite.addTestSuite(XPathOverDOMTests.class);
suite.addTestSuite(LogicalOpTests.class);
- suite.addTestSuite(ParentStepTests.class);
- suite.addTestSuite(XPathTokenScannerTests.class);
- suite.addTestSuite(ExpandedNameTests.class);
- suite.addTestSuite(EObjectInspectorTests.class);
suite.addTestSuite(XPathOverEcoreTests.class);
- suite.addTestSuite(VariableTests.class);
+ suite.addTestSuite(EStructuralFeatureSettingTests.class);
+ suite.addTestSuite(ChildStepTests.class);
+ suite.addTestSuite(ParentStepTests.class);
suite.addTestSuite(RootTests.class);
- suite.addTestSuite(ResourceInspectorTests.class);
- suite.addTestSuite(NumberBinaryOpTests.class);
suite.addTestSuite(XPathParserDefects.class);
+ suite.addTestSuite(VariableTests.class);
//$JUnit-END$
return suite;
}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/EObjectInspectorTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/EObjectInspectorTests.java
index f462be8..227bc57 100644
--- a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/EObjectInspectorTests.java
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/EObjectInspectorTests.java
@@ -851,4 +851,52 @@ public class EObjectInspectorTests extends TestCase {
assertEquals(1, namedChildren.length);
assertEquals("Hello Bob!", inspector.stringValueOf(namedChildren[0]));
}
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.inspectors.EObjectInspector2.expandedNameOf(Object)'
+ */
+ public void testTestExpandedName_emf() {
+ ExpandedName enEmfRootContents = new ExpandedName("contents");
+ assertTrue("root contents", inspector.testExpandedName(emfRoot, enEmfRootContents));
+ ExpandedName enEmfRootEmployee = new ExpandedName("Employee");
+ assertTrue("root Employee", inspector.testExpandedName(emfRoot, enEmfRootEmployee));
+
+ Object employee = ((Employee)emfRoot).getCustomers().get(0);
+ ExpandedName enCustomers = new ExpandedName("customers");
+ assertTrue("employee/customers", inspector.testExpandedName(employee, enCustomers));
+ ExpandedName enCustomer = new ExpandedName("Customer");
+ assertTrue("employee /Customer", inspector.testExpandedName(employee, enCustomer));
+ }
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.inspectors.EObjectInspector2.expandedNameOf(Object)'
+ */
+ public void testTestExpandedName_xml() {
+ ExpandedName enRoot = new ExpandedName("root");
+ assertTrue("root /root", inspector.testExpandedName(xmlRootElement, enRoot));
+
+ ExpandedName enAny = new ExpandedName("Any");
+ assertFalse("root /Any", inspector.testExpandedName(xmlRootElement, enAny));
+
+// final Object value = xmlRootElement.getAny().getValue(0);
+ final Object elementA = Bug130552Workaround.getValue(xmlRootElement.getAny(), 0);
+
+
+ ExpandedName enA = new ExpandedName("a");
+ assertTrue("a /a", inspector.testExpandedName(elementA, enA));
+
+ assertFalse("a /Any", inspector.testExpandedName(elementA, enAny));
+ }
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.inspectors.EObjectInspector2.expandedNameOf(Object)'
+ */
+ public void testTestExpandedName_xsd() {
+ ExpandedName enRoot = new ExpandedName("http://www.example.org/beans", "root");
+ assertTrue("root /root", inspector.testExpandedName(xsdRootElement, enRoot));
+
+ final Object elementProject = xsdRootElement.eContents().get(0);
+ ExpandedName enProject = new ExpandedName("project");
+ assertTrue("project /project", inspector.testExpandedName(elementProject, enProject));
+ }
}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/SelfStepTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/SelfStepTests.java
new file mode 100644
index 0000000..951bca9
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/SelfStepTests.java
@@ -0,0 +1,117 @@
+package org.eclipse.jet.tests.xpath;
+
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.Resource.Factory;
+import org.eclipse.jet.internal.xpath.ast.Axis;
+import org.eclipse.jet.internal.xpath.ast.ContextNode;
+import org.eclipse.jet.internal.xpath.ast.NodeTest;
+import org.eclipse.jet.internal.xpath.ast.Step;
+import org.eclipse.jet.xpath.Context;
+import org.eclipse.jet.xpath.inspector.ExpandedName;
+import org.eclipse.jet.xpath.inspector.INodeInspector.NodeKind;
+
+public class SelfStepTests extends TestCase {
+
+ protected Resource emfResource;
+ protected EObject emfRoot;
+ protected EObject emfCustomer;
+
+ protected void emfSetUp() throws Exception {
+
+ URI fileURI = URI.createURI("platform:/plugin/org.eclipse.jet.tests/data/sample.dataaccess");
+ Factory factory = Resource.Factory.Registry.INSTANCE.getFactory(fileURI);
+
+ emfResource = factory.createResource(fileURI);
+ emfResource.load(null);
+
+ emfRoot = (EObject) emfResource.getContents().get(0);
+
+ emfCustomer = (EObject) emfRoot.eContents().get(0);
+
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ emfSetUp();
+ }
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.ast.Step.evalAsNodeSet(Context)'
+ */
+ public void testEvalAsNodeSet_root_element_contents() {
+ Step stepExpr = new Step(new ContextNode(),
+ Axis.selfAxis(),
+ NodeTest.nameTest(NodeKind.ELEMENT, new ExpandedName("contents")));
+
+ Context context = new Context(emfRoot, null);
+
+ Set resultSet = stepExpr.evalAsNodeSet(context);
+
+ assertNotNull(resultSet);
+ assertEquals(1, resultSet.size());
+ assertTrue(resultSet.contains(emfRoot));
+
+ }
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.ast.Step.evalAsNodeSet(Context)'
+ */
+ public void testEvalAsNodeSet_root_element_Employee() {
+ Step stepExpr = new Step(new ContextNode(),
+ Axis.selfAxis(),
+ NodeTest.nameTest(NodeKind.ELEMENT, new ExpandedName("Employee")));
+
+ Context context = new Context(emfRoot, null);
+
+ Set resultSet = stepExpr.evalAsNodeSet(context);
+
+ assertNotNull(resultSet);
+ assertEquals(1, resultSet.size());
+ assertTrue(resultSet.contains(emfRoot));
+
+ }
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.ast.Step.evalAsNodeSet(Context)'
+ */
+ public void testEvalAsNodeSet_customer_element_customers() {
+ Step stepExpr = new Step(new ContextNode(),
+ Axis.selfAxis(),
+ NodeTest.nameTest(NodeKind.ELEMENT, new ExpandedName("customers")));
+
+ Context context = new Context(emfCustomer, null);
+
+ Set resultSet = stepExpr.evalAsNodeSet(context);
+
+ assertNotNull(resultSet);
+ assertEquals(1, resultSet.size());
+ assertTrue(resultSet.contains(emfCustomer));
+
+ }
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.ast.Step.evalAsNodeSet(Context)'
+ */
+ public void testEvalAsNodeSet_customer_element_Customer() {
+ Step stepExpr = new Step(new ContextNode(),
+ Axis.selfAxis(),
+ NodeTest.nameTest(NodeKind.ELEMENT, new ExpandedName("Customer")));
+
+ Context context = new Context(emfCustomer, null);
+
+ Set resultSet = stepExpr.evalAsNodeSet(context);
+
+ assertNotNull(resultSet);
+ assertEquals(1, resultSet.size());
+ assertTrue(resultSet.contains(emfCustomer));
+
+ }
+
+}