Package ca.ecliptical.emf.xpath

Examples of ca.ecliptical.emf.xpath.EMFXPath.addNamespace()


    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


    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

    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);
  }
 
  public final void testSum() throws Exception {
View Full Code Here

    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

    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

  }
 
  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

    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);
View Full Code Here

  }
 
  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);
View Full Code Here

    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

    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);
  }
 
  public static void main(String[] args) throws Exception {
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.