예제 #1
0
 @Test(expected = TransformException.class)
 public void restoreBadQuery() throws RuleBaseException, TransformException {
   setModNearestAncestorImplementing(
       NodeTarget.class,
       new NodeTarget() {
         public ItemList targets() throws TransformException {
           return content.query().all("/id('c1')");
         }
       });
   setModScope(content.query().single("/id('c1')").node().query());
   SortByValueBlock block = define("<sort by='ascending'>*</sort>");
   SortByValueBlock.SortByValueSeg seg = (SortByValueBlock.SortByValueSeg) block.createSeg(mod);
   seg.restore();
 }
예제 #2
0
 @Test
 public void restore() throws RuleBaseException, TransformException {
   setModNearestAncestorImplementing(
       NodeTarget.class,
       new NodeTarget() {
         public ItemList targets() throws TransformException {
           return content.query().all("/id('m1 m2')");
         }
       });
   setModScope(
       content.query().single("/id('m1')").node().query(),
       content.query().single("/id('m2')").node().query());
   SortByValueBlock block = define("<sort by='ascending'>@name</sort>");
   SortByValueBlock.SortByValueSeg seg = (SortByValueBlock.SortByValueSeg) block.createSeg(mod);
   seg.restore();
   assertEquals(
       Arrays.asList(
           new Pair[] {
             Pair.of("m1", content.query().single("/id('m1')/@name").toAtomicItem()),
             Pair.of("m2", content.query().single("/id('m2')/@name").toAtomicItem())
           }),
       seg.values);
 }