Package ro.isdc.wro.model

Examples of ro.isdc.wro.model.WroModel


          throws IOException {
        return TestGroovyModelFactory.class.getResourceAsStream("wro.json");
      };
    };
    WroTestUtils.init(factory);
    final WroModel expected = factory.create();
    WroTestUtils.runConcurrently(new Callable<Void>() {
      @Override
      public Void call()
          throws Exception {
        Assert.assertEquals(expected, factory.create());
View Full Code Here


      protected InputStream getModelResourceAsStream()
          throws IOException {
        return TestGroovyModelFactory.class.getResourceAsStream("wro.groovy");
      };
    };
    final WroModel model = factory.create();
    Assert.assertNotNull(model);
    Assert.assertEquals(Arrays.asList("g1", "g2"), new WroModelInspector(model).getGroupNames());
    Assert.assertEquals(2, model.getGroupByName("g1").getResources().size());
    Assert.assertTrue(model.getGroupByName("g1").getResources().get(0).isMinimize());
    Assert.assertEquals("/static/app.js", model.getGroupByName("g1").getResources().get(0).getUri());
    Assert.assertEquals(ResourceType.JS, model.getGroupByName("g1").getResources().get(0).getType());
    Assert.assertTrue(model.getGroupByName("g1").getResources().get(1).isMinimize());
    Assert.assertEquals("/static/app.css", model.getGroupByName("g1").getResources().get(1).getUri());
    Assert.assertEquals(ResourceType.CSS, model.getGroupByName("g1").getResources().get(1).getType());
    Assert.assertEquals(2, model.getGroupByName("g2").getResources().size());
    Assert.assertFalse(model.getGroupByName("g2").getResources().get(1).isMinimize());

    LOG.debug("model: ", model);
  }
View Full Code Here

      protected InputStream getModelResourceAsStream()
          throws IOException {
        return getClass().getResourceAsStream("wroWithHiphen.groovy");
      }
    };
    final WroModel model = factory.create();
    Assert.assertNotNull(model.getGroupByName("group-with-hiphen"));
  }
View Full Code Here

      protected InputStream getModelResourceAsStream()
          throws IOException {
        return getClass().getResourceAsStream("abstractGroup.groovy");
      }
    };
    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

          throws IOException {
        return TestGroovyModelFactory.class.getResourceAsStream("wro.groovy");
      };
    };
    WroTestUtils.init(factory);
    final WroModel expectedModel = factory.create();
    WroTestUtils.runConcurrently(new Callable<Void>() {
      @Override
      public Void call()
          throws Exception {
        Assert.assertEquals(expectedModel, factory.create());
View Full Code Here

          throws IOException {
        return TestGroovyModelFactory.class.getResourceAsStream("wro.groovy");
      };
    }, modelTransformers);
    WroTestUtils.init(factory);
    final WroModel expectedModel = factory.create();
    WroTestUtils.runConcurrently(new ContextPropagatingCallable<Void>(new Callable<Void>() {
      @Override
      public Void call()
          throws Exception {
        Assert.assertEquals(expectedModel, factory.create());
View Full Code Here

  @Test
  public void onMockFactoryProvided2()
      throws Exception {
    final WroModelFactory mockFactory = Mockito.mock(WroModelFactory.class);
    Mockito.when(mockFactory.create()).thenReturn(new WroModel());
    final List<WroModelFactory> list = Arrays.asList(mockFactory);
    factory = new SmartWroModelFactory().setFactoryList(list);
    injector.inject(factory);
    Assert.assertNotNull(factory.create());
  }
View Full Code Here

      }
    };
    final WroModelFactory workingModelFactory = new WroModelFactory() {
      @Override
      public WroModel create() {
        return new WroModel();
      }

      @Override
      public void destroy() {
      }
View Full Code Here

        final List<WroModelFactory> list = new ArrayList<WroModelFactory>();
        list.add(new CustomWroModel() {
          @Override
          public WroModel create() {
            Assert.assertNotNull("Should have an injected locator!", uriLocatorFactory);
            return new WroModel();
          }
        });
        return list;
      }
    };
View Full Code Here

      final Type type = new TypeToken<WroModel>() {}.getType();
      final InputStream is = getModelResourceAsStream();
      if (is == null) {
        throw new WroRuntimeException("Invalid model stream provided!");
      }
      final WroModel model = new Gson().fromJson(new InputStreamReader(getModelResourceAsStream()), type);
      LOG.debug("json model: {}", model);
      if (model == null) {
        throw new WroRuntimeException("Invalid content provided, cannot build model!");
      }
      return model;
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.