コード例 #1
0
  /** Test simple layout contains expected number of configs */
  @Test
  public void testSimpleLayout() {
    ModelAndViewConfig viewAndConfig =
        customizationAssemblyFactory.getModelAndViewConfig(
            "studentProfile", simpleMaleStudentEntity.get("id"));

    Assert.assertEquals(3, viewAndConfig.getConfig().size());
  }
コード例 #2
0
  @Test
  public void testCache() {
    ApplicationContext goodContext =
        new AnnotationConfigApplicationContext(
            new Class<?>[] {ContextConfigurationWithGoodMananger.class});
    customizationAssemblyFactory.setApplicationContext(goodContext);
    ModelAndViewConfig modelAndViewConfig =
        customizationAssemblyFactory.getModelAndViewConfig("test", "section", true);
    Config testConfig = modelAndViewConfig.getConfig().get("test");
    Assert.assertEquals("section", testConfig.getId());
    Assert.assertEquals("section", testConfig.getParentId());
    Assert.assertEquals("SLC - Section Profile", testConfig.getName());
    Assert.assertEquals("LAYOUT", testConfig.getType().toString());
    Item[] items = testConfig.getItems();
    Assert.assertEquals(2, items.length);
    Assert.assertEquals("tab3", items[0].getId());
    Assert.assertEquals("List of Students", items[0].getName());
    Item[] itemA = items[0].getItems();
    Assert.assertEquals(1, itemA.length);
    Assert.assertEquals("listOfStudents", itemA[0].getId());
    Item[] itemAA = itemA[0].getItems();
    Assert.assertEquals(1, itemAA.length);
    Assert.assertEquals("Default View", itemAA[0].getName());
    Item[] itemAAA = itemAA[0].getItems();
    Assert.assertEquals(5, itemAAA.length);
    Assert.assertEquals("Student", itemAAA[0].getName());
    Assert.assertEquals("", itemAAA[1].getName());
    Assert.assertEquals("Grade", itemAAA[2].getName());
    Assert.assertEquals("Absence Count", itemAAA[3].getName());
    Assert.assertEquals("Tardy Count", itemAAA[4].getName());

    Assert.assertEquals("tab4", items[1].getId());
    Assert.assertEquals("LOS", items[1].getName());
    Item[] itemB = items[1].getItems();
    Assert.assertEquals(1, itemB.length);
    Assert.assertEquals("listOfStudents", itemB[0].getId());
    Item[] itemBA = itemB[0].getItems();
    Assert.assertEquals(1, itemBA.length);
    Assert.assertEquals("Default View", itemBA[0].getName());
    Item[] itemBAA = itemBA[0].getItems();
    Assert.assertEquals(5, itemBAA.length);
    Assert.assertEquals("Student", itemBAA[0].getName());
    Assert.assertEquals("", itemBAA[1].getName());
    Assert.assertEquals("Grade", itemBAA[2].getName());
    Assert.assertEquals("Absence Count", itemBAA[3].getName());
    Assert.assertEquals("Tardy Count", itemBAA[4].getName());
  }