Esempio n. 1
0
  public void setUp() throws Exception {
    super.setUp();
    MockServletContext context = new MockServletContext();
    final Properties p = new Properties();
    p.setProperty("web.config.classname.mappings", "CLASS_NAME_MAPPINGS");
    p.setProperty("web.config.fieldname.mappings", "FIELD_NAME_MAPPINGS");
    SessionMethods.setWebProperties(context, p);

    final InputStream is = getClass().getClassLoader().getResourceAsStream("WebConfigTest.xml");
    final InputStream classesIS =
        getClass().getClassLoader().getResourceAsStream("testClassMappings.properties");
    final InputStream fieldsIS =
        getClass().getClassLoader().getResourceAsStream("testFieldMappings.properties");
    context.addInputStream("/WEB-INF/webconfig-model.xml", is);
    context.addInputStream("/WEB-INF/CLASS_NAME_MAPPINGS", classesIS);
    context.addInputStream("/WEB-INF/FIELD_NAME_MAPPINGS", fieldsIS);
    webConfig = WebConfig.parse(context, os.getModel());
  }
 public void setUp() throws Exception {
   super.setUp();
 }
Esempio n. 3
0
  public void setUp() throws Exception {
    super.setUp();
    osd = new ObjectStoreDummyImpl();
    osd.setResultsSize(15);

    // Set up some known objects in the first 3 results rows
    department1 = new Department();
    department1.setName("Department1");
    department1.setId(new Integer(4));
    department2 = new Department();
    department2.setName("Department2");
    department2.setId(new Integer(5));
    department3 = new Department();
    department3.setName("Department3");
    department3.setId(new Integer(6));

    company1 = (Company) DynamicUtil.createObject(Collections.singleton(Company.class));
    company1.setName("Company1");
    company1.setVatNumber(101);
    company1.setId(new Integer(1));
    company2 = (Company) DynamicUtil.createObject(Collections.singleton(Company.class));
    company2.setName("Company2");
    company2.setVatNumber(102);
    company2.setId(new Integer(2));
    company3 = (Company) DynamicUtil.createObject(Collections.singleton(Company.class));
    company3.setName("Company3");
    company3.setVatNumber(103);
    company3.setId(new Integer(3));

    man1 = (Manager) DynamicUtil.createObject(Collections.singleton(Manager.class));
    man1.setName("Manager1");
    man1.setSeniority(new Integer(100));
    man1.setId(new Integer(1));
    man2 = (Manager) DynamicUtil.createObject(Collections.singleton(Manager.class));
    man2.setName("Manager2");
    man2.setSeniority(new Integer(200));
    man2.setId(new Integer(2));
    man3 = (CEO) DynamicUtil.createObject(Collections.singleton(CEO.class));
    man3.setName("Manager3");
    man3.setSeniority(new Integer(300));
    man3.setId(new Integer(3));
    man3.setCompany(company3);

    ResultsRow row = new ResultsRow();
    row.add(department1);
    row.add(company1);
    row.add(man1);
    osd.addRow(row);
    row = new ResultsRow();
    row.add(department2);
    row.add(company2);
    row.add(man2);
    osd.addRow(row);
    row = new ResultsRow();
    row.add(department3);
    row.add(company3);
    row.add(man3);
    osd.addRow(row);
    classKeys = new HashMap();
    FieldDescriptor fd =
        model
            .getClassDescriptorByName("org.intermine.model.testmodel.Company")
            .getFieldDescriptorByName("name");
    ArrayList<FieldDescriptor> keys = new ArrayList();
    keys.add(fd);
    classKeys.put("Company", keys);
  }