Package ro.isdc.wro.model

Examples of ro.isdc.wro.model.WroModel


    Assert.assertEquals(1, changedModel.getGroupByName("group").getResources().size());
  }
 
  @Test
  public void testExpandWildcardWithMultipleResources() {
    final WroModel model = new WroModel();
    final String uri = String.format(ClasspathUriLocator.PREFIX + "%s/expander/*.js",
        WroUtil.toPackageAsFolder(getClass()));
    model.addGroup(new Group("group").addResource(Resource.create(uri, ResourceType.JS)));
    Mockito.when(decoratedFactory.create()).thenReturn(model);
   
    final WroModel changedModel = transformer.transform(model);
    LOG.debug("model: {}", changedModel);
    Assert.assertEquals(3, changedModel.getGroupByName("group").getResources().size());
  }
View Full Code Here


    Assert.assertEquals("/js2.js", group.getResources().get(1).getUri());
  }
 
  @Test
  public void shouldCorrectlyDetectFilesFromFoldersWithDirectoriesOnlyAsChildren() {
    final WroModel model = new WroModel();
    final String uri = String.format(ClasspathUriLocator.PREFIX + "%s/expander/subfolder/**.js",
        WroUtil.toPackageAsFolder(getClass()));
    model.addGroup(new Group("group").addResource(Resource.create(uri, ResourceType.JS)));
    Mockito.when(decoratedFactory.create()).thenReturn(model);
   
    final WroModel changedModel = transformer.transform(model);
    LOG.debug("model: {}", changedModel);
   
    final String resultPathPrefix = String.format("%s%s/expander/subfolder", ClasspathUriLocator.PREFIX,
        WroUtil.toPackageAsFolder(getClass()));
   
    Assert.assertEquals(2, changedModel.getGroupByName("group").getResources().size());
    Assert.assertEquals(resultPathPrefix + "/folder1/script1.js",
        changedModel.getGroupByName("group").getResources().get(0).getUri());
    Assert.assertEquals(resultPathPrefix + "/folder2/script2.js",
        changedModel.getGroupByName("group").getResources().get(1).getUri());
  }
View Full Code Here

        changedModel.getGroupByName("group").getResources().get(1).getUri());
  }
 
  @Test
  public void wildcardResourcesAreOrderedAlphabetically() {
    final WroModel model = new WroModel();
    final String uri = String.format(ClasspathUriLocator.PREFIX + "%s/expander/order/**.js",
        WroUtil.toPackageAsFolder(getClass()));
    model.addGroup(new Group("group").addResource(Resource.create(uri, ResourceType.JS)));
    Mockito.when(decoratedFactory.create()).thenReturn(model);
   
    final WroModel changedModel = transformer.transform(model);
    LOG.debug("model: {}", changedModel);
   
    Assert.assertEquals(7, changedModel.getGroupByName("group").getResources().size());
    final List<Resource> resources = changedModel.getGroupByName("group").getResources();
   
    Assert.assertEquals("01-xyc.js", FilenameUtils.getName(resources.get(0).getUri()));
    Assert.assertEquals("02-xyc.js", FilenameUtils.getName(resources.get(1).getUri()));
    Assert.assertEquals("03-jquery-ui.js", FilenameUtils.getName(resources.get(2).getUri()));
    Assert.assertEquals("04-xyc.js", FilenameUtils.getName(resources.get(3).getUri()));
View Full Code Here

      protected InputStream getModelResourceAsStream() {
        return Thread.currentThread().getContextClassLoader().getResourceAsStream("wro1.xml");
      }
    };
    // the uriLocator factory doesn't have any locators set...
    final WroModel model = factory.create();
    LOG.debug("model: " + model);
  }
View Full Code Here

    LOG.debug("model: " + model);
  }
 
  @Test
  public void testMinimizeAttributePresence() {
    final WroModel model = loadModelFromLocation("wro-minimizeAttribute.xml");
    final Group group = model.getGroupByName(new WroModelInspector(model).getGroupNames().get(0));
    final List<Resource> resourceList = group.getResources();
    LOG.debug("resources: " + resourceList);
    assertEquals(false, resourceList.get(0).isMinimize());
    assertEquals(true, resourceList.get(1).isMinimize());
    assertEquals(true, resourceList.get(2).isMinimize());
View Full Code Here

    LOG.debug("model: " + model);
  }
 
  @Test
  public void testValidImports() {
    final WroModel model = loadModelFromLocation("testimport/validImports.xml");
    assertEquals(2, new WroModelInspector(model).getGroupNames().size());
    LOG.debug("model: " + model);
  }
View Full Code Here

        return new ByteArrayInputStream("<xml></xml>".getBytes());
      }
    }.setValidateXml(false);
    WroTestUtils.init(factory);
    // will create an empty model
    assertEquals(new WroModel(), factory.create());
  }
View Full Code Here

        // get a class relative test resource
        return TestXmlModelFactory.class.getResourceAsStream("testimport/validImports.xml");
      }
    };
    WroTestUtils.init(factory);
    final WroModel expected = factory.create();
   
    WroTestUtils.runConcurrently(new ContextPropagatingCallable<Void>(new Callable<Void>() {
      public Void call()
          throws Exception {
        assertEquals(expected, factory.create());
View Full Code Here

    }), 10);
  }
 
  @Test
  public void shouldCreateEmptyModelWhenAllGroupsAreAbstract() {
    final WroModel model = loadModelFromLocation("shouldCreateEmptyModelWhenAllGroupsAreAbstract.xml");
    assertTrue(model.getGroups().isEmpty());
  }
View Full Code Here

    assertTrue(model.getGroups().isEmpty());
  }
 
  @Test
  public void shouldCreateNonEmptyModelWhenSomeGroupsAreAbstract() {
    final WroModel model = loadModelFromLocation("shouldCreateNonEmptyModelWhenSomeGroupsAreAbstract.xml");
    assertEquals(2, model.getGroups().size());
  }
View Full Code Here

TOP

Related Classes of ro.isdc.wro.model.WroModel

Copyright © 2018 www.massapicom. 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.