/**
  * Creates the context.
  *
  * @throws Exception if context can't be created
  */
 @Before
 public void context() throws Exception {
   final ContextBuilder builder = new ContextBuilder().configureDefault();
   new FileXmlContextBuilderConfigurator(getClass().getResource("/wuic-sprite.xml"))
       .configure(builder);
   ctx = builder.build();
 }
 /**
  * Tests a workflow built on top of a composition.
  *
  * @throws Exception if test fails
  */
 @Test
 public void compositionByWorkflowTest() throws Exception {
   final ContextBuilder builder = new ContextBuilder();
   EngineBuilderFactory.getInstance().newContextBuilderConfigurator().configure(builder);
   new FileXmlContextBuilderConfigurator(getClass().getResource("/wuic-deep.xml"))
       .configure(builder);
   final Context ctx = builder.build();
   ctx.process("", "composite");
 }
  /**
   * Test when file is referenced with '../'.
   *
   * @throws Exception if test fails
   */
  @Test
  public void parentRefTest() throws Exception {
    final ContextBuilder builder = new ContextBuilder();
    EngineBuilderFactory.getInstance().newContextBuilderConfigurator().configure(builder);
    new FileXmlContextBuilderConfigurator(getClass().getResource("/wuic-deep.xml"))
        .configure(builder);
    final Context ctx = builder.build();

    // ../ refers a file inside base directory hierarchy
    List<Nut> group = ctx.process("", "css-inner");
    Assert.assertEquals(1, group.size());
    Assert.assertEquals(3, group.get(0).getReferencedNuts().size());

    // ../ refers a file outside base directory hierarchy
    group = ctx.process("", "css-outer");
    Assert.assertEquals(1, group.size());
    Assert.assertEquals(2, group.get(0).getReferencedNuts().size());
  }