Examples of EMFXPath


Examples of ca.ecliptical.emf.xpath.EMFXPath

    subTest2.setInstanceType(XMLTypePackage.Literals.INT);
    subTest2.setValue(new Integer(2));
  }

  public final void testSelectChildWithPredicate() throws Exception {
    EMFXPath xpath = new EMFXPath("lib:books[lib:title='Book 1']");
    xpath.addNamespace("lib", LibraryPackage.eNS_URI);
    Book book = (Book) xpath.selectSingleNode(fixture);
    assertNotNull(book);
    assertEquals("Book 1", book.getTitle());
  }
View Full Code Here

Examples of ca.ecliptical.emf.xpath.EMFXPath

    assertNotNull(book);
    assertEquals("Book 1", book.getTitle());
  }

  public final void testNonContainmentRef() throws Exception {
    EMFXPath xpath = new EMFXPath("lib:books[lib:author=current()/lib:writers[lib:name='Writer 1']]");
    xpath.addNamespace("lib", LibraryPackage.eNS_URI);
    Book book = (Book) xpath.selectSingleNode(fixture);
    assertNotNull(book);
    assertEquals("Book 1", book.getTitle());
  }
View Full Code Here

Examples of ca.ecliptical.emf.xpath.EMFXPath

    assertNotNull(book);
    assertEquals("Book 1", book.getTitle());
  }
 
  public final void testStringValueOf() throws Exception {
    EMFXPath xpath = new EMFXPath("lib:writers[lib:books[.=//lib:books[lib:category='Mystery']]]/lib:name");
    xpath.addNamespace("lib", LibraryPackage.eNS_URI);
    String result = xpath.stringValueOf(fixture);
    assertEquals("Writer 1", result);
  }
View Full Code Here

Examples of ca.ecliptical.emf.xpath.EMFXPath

    String result = xpath.stringValueOf(fixture);
    assertEquals("Writer 1", result);
  }
 
  public final void testSum() throws Exception {
    EMFXPath xpath = new EMFXPath("sum(lib:books/lib:pages)");
    xpath.addNamespace("lib", LibraryPackage.eNS_URI);
    Number result = xpath.numberValueOf(fixture);
    assertNotNull(result);
    assertEquals(6000, result.intValue());
  }
View Full Code Here

Examples of ca.ecliptical.emf.xpath.EMFXPath

    assertNotNull(result);
    assertEquals(6000, result.intValue());
  }
 
  public final void testFeatureMap() throws Exception {
    EMFXPath xpath = new EMFXPath("/resources/contents/t:test/t:subTest[x:value='2']");
    xpath.addNamespace("t", "urn:test");
    xpath.addNamespace("x", XMLTypePackage.eNS_URI);
    SimpleAnyType result = (SimpleAnyType) xpath.selectSingleNode(fixture);
    assertNotNull(result);
    assertEquals(new Integer(2), result.getValue());
  }
View Full Code Here

Examples of ca.ecliptical.emf.xpath.EMFXPath

    assertNotNull(result);
    assertEquals(new Integer(2), result.getValue());
  }
 
  public final void testNamespaces() throws Exception {
    EMFXPath xpath = new EMFXPath("/resources/contents/t:test/t:subTest[1]/x:value/namespace::*");
    xpath.addNamespace("t", "urn:test");
    xpath.addNamespace("x", XMLTypePackage.eNS_URI);
    List list = xpath.selectNodes(fixture);
    assertNotNull(list);
    assertEquals(2, list.size());
    assertTrue(list.get(0) instanceof EPackage);
    assertTrue(list.get(1) instanceof EPackage);
    HashSet values = new HashSet(2);
View Full Code Here

Examples of ca.ecliptical.emf.xpath.EMFXPath

    assertTrue(values.contains("urn:test"));
    assertTrue(values.contains(XMLTypePackage.eNS_URI));
  }

  public final void testContentsFunction() throws Exception {
    EMFXPath xpath = new EMFXPath("lib:books[contents(lib:author)/lib:name='Writer 1']");
    xpath.addNamespace("lib", LibraryPackage.eNS_URI);
    Book book = (Book) xpath.selectSingleNode(fixture);
    assertNotNull(book);
    assertEquals("Book 1", book.getTitle());
  }
View Full Code Here

Examples of ca.ecliptical.emf.xpath.EMFXPath

    assertNotNull(book);
    assertEquals("Book 1", book.getTitle());
  }

  public final void testEClassFunction() throws Exception {
    EMFXPath xpath = new EMFXPath("eClass()/ecore:name");
    xpath.addNamespace("ecore", EcorePackage.eNS_URI);
    String eClassName = xpath.stringValueOf(fixture);
    assertEquals("Library", eClassName);
  }
View Full Code Here

Examples of ca.ecliptical.emf.xpath.EMFXPath

   * @param query
   * @return
   * @throws JaxenException
   */
  public static List<?> query(final EObject root, String query) throws JaxenException {
    EMFXPath xpath = new EMFXPath(query);
    xpath.addNamespace("iaml", ModelPackage.eNS_URI);
    xpath.addNamespace("iaml.domain", DomainPackage.eNS_URI);
    xpath.addNamespace("iaml.scopes", ScopesPackage.eNS_URI);
    xpath.addNamespace("iaml.visual", VisualPackage.eNS_URI);
    xpath.addNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
    return xpath.selectNodes(root);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.