Package ro.isdc.wro.model.group

Examples of ro.isdc.wro.model.group.Group


    final File groupNameMappingFile = WroUtil.createTempFile();

    final Resource g1Resource = spy(Resource.create("1.js"));
    try {
      final WroModel model = new WroModel();
      model.addGroup(new Group("g1").addResource(g1Resource));
      model.addGroup(new Group("g2").addResource(Resource.create("2.js")));
      victim = new Wro4jMojo() {
        @Override
        protected WroManagerFactory newWroManagerFactory()
            throws MojoExecutionException {
          final DefaultStandaloneContextAwareManagerFactory managerFactory = new DefaultStandaloneContextAwareManagerFactory();
View Full Code Here


   * Store digest for all resources contained inside the list of provided groups.
   */
  private void persistResourceFingerprints(final List<String> groupNames) {
    final WroModelInspector modelInspector = new WroModelInspector(getModel());
    for (final String groupName : groupNames) {
      final Group group = modelInspector.getGroupByName(groupName);
      if (group != null) {
        for (final Resource resource : group.getResources()) {
          getResourceChangeHandler().remember(resource);
        }
      }
    }
  }
View Full Code Here

    @Override
    protected WroModelFactory newModelFactory() {
      return new WroModelFactory() {
        public WroModel create() {
          return new WroModel().addGroup(new Group("all"));
        }

        public void destroy() {
        }
      };
View Full Code Here

      };
    };
    final WroModel model = factory.create();
    Assert.assertNotNull(model);
    Assert.assertEquals(1, model.getGroups().size());
    final Group group = new ArrayList<Group>(model.getGroups()).get(0);
    Assert.assertNull(group.getResources().get(0).getType());
    LOG.debug("model: {}", model);
  }
View Full Code Here

      }
    };
    final WroModel model = factory.create();
    assertNotNull(model);
    assertEquals(1, model.getGroups().size());
    final Group group = model.getGroups().iterator().next();
    assertEquals("nonAbstractGroup", group.getName());
    assertEquals(1, group.getResources().size());
  }
View Full Code Here

  private WroModel createWroModelExternalModelStub() {
    final WroModel wroModel = new WroModel();
    final List<Group> wroGroups = new ArrayList<Group>();
    wroGroups.addAll(createSimpleModelStub().getGroups());

    final Group extGroup = new Group("external");
    final Resource resource = new Resource();
    resource.setType(ResourceType.JS);
    resource.setUri("https://www.site.com/style.js");
    resource.setMinimize(false);

    extGroup.addResource(resource);
    extGroup.addResource(Resource.create("http://www.site.com/style.css"));
    wroGroups.add(extGroup);

    wroModel.setGroups(wroGroups);
    return wroModel;
  }
View Full Code Here

  }

  private WroModel createSimpleModelStub() {
    final WroModel wroModel = new WroModel();
    final List<Group> wroGroups = new ArrayList<Group>();
    final Group group = new Group("test");
    final Resource resource = new Resource();
    resource.setType(ResourceType.JS);
    resource.setUri("test.js");
    resource.setMinimize(true);
    group.addResource(resource);
    wroGroups.add(group);
    wroModel.setGroups(wroGroups);
    return wroModel;
  }
View Full Code Here

          wasCreated = true;
          // return model with no groups defined
          return new WroModel();
        }
        // second time when created add one group
        return new WroModel().addGroup(new Group("g1"));
      }

      public void destroy() {
      }
    });
View Full Code Here

  }

  @Test
  public void testGetExistingGroup() {
    Assert.assertFalse(victim.getGroups().isEmpty());
    final Group group = victim.getGroupByName("g1");
    // create a copy of original list
    assertEquals(1, group.getResources().size());
  }
View Full Code Here

  public void shouldNotReturnDuplicatedResources() {
    final WroModel model = new WroModel();

    assertEquals(0, new WroModelInspector(model).getAllUniqueResources().size());

    model.addGroup(new Group("one").addResource(Resource.create("/one.js"))).addGroup(
        new Group("two").addResource(Resource.create("/one.js")));
    assertEquals(1, new WroModelInspector(model).getAllUniqueResources().size());
  }
View Full Code Here

TOP

Related Classes of ro.isdc.wro.model.group.Group

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.