@Test(expected = TransformException.class) public void resolveOrderBadQuery() throws RuleBaseException, TransformException { SortBlock block = define("<sort as='corresponding'>*</sort>"); Node uc1 = content.query().single("/id('uc1')").node(); setModBuilderCustomScope(uc1.query()); block.resolveOrder(modBuilder, uc1); }
@Test(expected = TransformException.class) public void resolveOrderNotSibling() throws RuleBaseException, TransformException { SortBlock block = define("<sort before='sibling'>.//uml:operation</sort>"); Node cname = content.query().single("/id('cname')").node(); Node uc1 = content.query().single("/id('uc1')").node(); setModBuilderCustomScope(uc1.query()); block.resolveOrder(modBuilder, cname); }
@Test public void resolveOrder() throws RuleBaseException, TransformException { SortBlock block = define("<sort by='ascending'>@name</sort>"); Node m1 = content.query().single("/id('m1')").node(); setModBuilderCustomScope(m1.query()); supplement(); block.resolveOrder(modBuilder, m1); checkSupplement("<sort-value refid='m1'>start</sort-value>"); }
@Test public void resolveOrderEmpty() throws RuleBaseException, TransformException { SortBlock block = define("<sort before='sibling'>()</sort>"); Node cname = content.query().single("/id('cname')").node(); Node uc1 = content.query().single("/id('uc1')").node(); setModBuilderCustomScope(uc1.query()); supplement(); block.resolveOrder(modBuilder, cname); checkSupplement("<sort-siblings run-length='0'/>"); }
@Test public void resolveOrder1() throws RuleBaseException, TransformException { SortBlock block = define("<sort after='sibling'>uml:name</sort>"); Node comp1 = content.query().single("/id('comp1')").node(); Node uc1 = content.query().single("/id('uc1')").node(); setModBuilderCustomScope(uc1.query()); reference(content.query().single("/id('cname')").node()); supplement(); block.resolveOrder(modBuilder, comp1); checkSupplement("<sort-siblings run-length='1'/>"); }
@Test public void resolveOrder() throws RuleBaseException, TransformException { SortBlock block = define("<sort as='corresponding'>$source</sort>"); Node um1 = content.query().single("/id('um1')").node(); Node m1 = content.query().single("/id('m1')").node(); setModBuilderCustomScope(um1.query().let("$source", m1)); reference(m1); supplement(); block.resolveOrder(modBuilder, um1); checkSupplement("<sort-proxy position='1'/>"); }