Exemplo n.º 1
0
  /** @throws java.lang.Exception */
  @Before
  public void setUpBefore() throws Exception {
    mockedRequest = Mockito.mock(HttpServletRequest.class);
    mockedResponse = Mockito.mock(HttpServletResponse.class);

    URL testfile = NewModelHandlerTest.class.getResource("/data/newmodelhandler/test1_svg.xml");
    File file = new File(testfile.toURI());
    svg = FileUtils.readFileToString(file, "UTF-8");

    testfile =
        NewModelHandlerTest.class.getResource("/data/newmodelhandler/test1_content_json.txt");
    file = new File(testfile.toURI());
    data = FileUtils.readFileToString(file, "UTF-8");

    // --
    // DataDefaults.all();
    Reader reader = Resources.getResourceAsReader("org/b3mn/poem/tests/myibitis-config.xml");
    sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
    reader.close();

    SqlSession session = sqlSessionFactory.openSession();
    Connection conn = session.getConnection();
    reader = Resources.getResourceAsReader("org/b3mn/poem/tests/test_reset_mysql_db_schema.sql");
    ScriptRunner runner = new ScriptRunner(conn);
    runner.setErrorLogWriter(null);
    runner.runScript(reader);
    reader.close();

    reader = Resources.getResourceAsReader("org/b3mn/poem/tests/test_data.sql");
    runner = new ScriptRunner(conn);
    runner.setErrorLogWriter(null);
    runner.runScript(reader);
    reader.close();

    session.close();

    title = "Job #1";
    type = "http://b3mn.org/stencilset/reporting#";
    summary = "";
    newModelIdentity = null;
    user = new User("public");

    handler = new NewModelHandler();
    assertNotNull(handler);

    handler.init();
  }
Exemplo n.º 2
0
 /** @throws java.lang.Exception */
 @After
 public void tearDownAfter() throws Exception {
   handler.destroy();
   // newModelIdentity.delete();
 }