コード例 #1
0
ファイル: Sort.java プロジェクト: young36832/dscribe
 private void runVerifyScenario(String proxyid, String modData)
     throws TransformException, RuleBaseException {
   Node um1 = content.query().single("/id('um1')").node();
   Node m1 = content.query().single("/id('m1')").node();
   setModNearestAncestorImplementing(
       NodeTarget.class,
       new NodeTarget() {
         public ItemList targets() throws TransformException {
           return content.query().all("/id('um1')");
         }
       });
   setModData(modData);
   setModReferences(content.query().single("/id($_1)", proxyid).node());
   setModScope(um1.query().let("$source", m1));
   SortByProxyBlock block = define("<sort as='corresponding'>$source</sort>");
   SortByProxyBlock.SortByProxySeg seg = (SortByProxyBlock.SortByProxySeg) block.createSeg(mod);
   seg.proxies = new ArrayList<Pair<String, Node>>();
   seg.proxies.add(Pair.of("um1", mod.references().get(0)));
   seg.verify();
 }
コード例 #2
0
ファイル: Sort.java プロジェクト: young36832/dscribe
 @Test
 public void sort() throws RuleBaseException {
   SortByProxyBlock block = define("<sort as='corresponding'>$source</sort>");
   SortByProxyBlock.SortByProxySeg seg1 = (SortByProxyBlock.SortByProxySeg) block.createSeg(mod);
   SortByProxyBlock.SortByProxySeg seg2 = (SortByProxyBlock.SortByProxySeg) block.createSeg(mod);
   seg1.proxies = new ArrayList<Pair<String, Node>>();
   seg2.proxies = new ArrayList<Pair<String, Node>>();
   seg1.proxies.add(Pair.of("um1", content.query().single("/id('m1')").node()));
   seg2.proxies.add(Pair.of("uf1", content.query().single("/id('f1')").node()));
   seg1.proxies.add(Pair.of("um2", content.query().single("/id('m2')").node()));
   seg2.proxies.add(Pair.of("uf2", content.query().single("/id('f1')").node()));
   final OrderGraph graph = mockery.mock(OrderGraph.class);
   mockery.checking(
       new Expectations() {
         {
           one(graph).order("um1", "um2", 0);
         }
       });
   block.sort(Arrays.asList(seg1, seg2), graph);
 }
コード例 #3
0
ファイル: Sort.java プロジェクト: young36832/dscribe
 @Test
 public void restore() throws RuleBaseException, TransformException {
   setModNearestAncestorImplementing(
       NodeTarget.class,
       new NodeTarget() {
         public ItemList targets() throws TransformException {
           return content.query().all("/id('um1 um2')");
         }
       });
   setModData("(<sort-proxy position='1'/>, <sort-proxy position='2'/>)");
   setModReferences(
       content.query().single("/id('m1')").node(), content.query().single("/id('m2')").node());
   SortByProxyBlock block = define("<sort as='corresponding'>$source</sort>");
   SortByProxyBlock.SortByProxySeg seg = (SortByProxyBlock.SortByProxySeg) block.createSeg(mod);
   seg.restore();
   assertEquals(
       Arrays.asList(
           new Pair[] {
             Pair.of("um1", content.query().single("/id('m1')").node()),
             Pair.of("um2", content.query().single("/id('m2')").node())
           }),
       seg.proxies);
 }